-- cgit v1.2.3 -- cgit v1.2.3 From b623a8a009755391f6a469166ee87f37de9af6f3 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 25 Nov 2008 14:05:35 +0000 Subject: migration from cvs --- sw/inc/dialog.hrc | 5 ++--- sw/inc/dochdl.hrc | 5 ++--- sw/source/ui/dbui/mailmergechildwindow.src | 4 ++-- sw/source/ui/dialog/dialog.src | 13 +++---------- sw/source/ui/dochdl/dochdl.src | 11 +++-------- sw/source/ui/dochdl/gloshdl.cxx | 8 ++++---- sw/source/ui/frmdlg/frmpage.src | 6 +++--- sw/source/ui/misc/insrule.src | 4 ++-- sw/source/ui/table/convert.src | 4 ++-- sw/source/ui/table/instable.src | 4 ++-- sw/source/ui/table/tabledlg.src | 4 ++-- sw/source/ui/uiview/view.hrc | 4 +--- sw/source/ui/uiview/view.src | 14 +------------- sw/source/ui/utlui/utlui.src | 4 ++-- 14 files changed, 31 insertions(+), 59 deletions(-) diff --git a/sw/inc/dialog.hrc b/sw/inc/dialog.hrc index 7e9b8b3389b9..deed99451d94 100644 --- a/sw/inc/dialog.hrc +++ b/sw/inc/dialog.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dialog.hrc,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.240.1 $ * * This file is part of OpenOffice.org. * @@ -54,8 +54,7 @@ #define STR_LINKEDIT_TEXT (RC_DIALOG_BEGIN + 1) #define STR_CLOSELINKMSG (RC_DIALOG_BEGIN + 3) -#define STR_PATH_NOT_FOUND1 (RC_DIALOG_BEGIN + 4) -#define STR_PATH_NOT_FOUND2 (RC_DIALOG_BEGIN + 5) +#define STR_PATH_NOT_FOUND (RC_DIALOG_BEGIN + 4) #define STR_FLT_SGV (RC_DIALOG_BEGIN + 8) diff --git a/sw/inc/dochdl.hrc b/sw/inc/dochdl.hrc index 29beaa022c92..1ee4b68efe10 100644 --- a/sw/inc/dochdl.hrc +++ b/sw/inc/dochdl.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dochdl.hrc,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.240.1 $ * * This file is part of OpenOffice.org. * @@ -33,8 +33,7 @@ #include "rcid.hrc" -#define STR_NOGLOS1 (RC_DOCHDL_BEGIN + 1) -#define STR_NOGLOS2 (RC_DOCHDL_BEGIN + 2) +#define STR_NOGLOS (RC_DOCHDL_BEGIN + 1) #define MSG_ERR_INSERT_GLOS (RC_DOCHDL_BEGIN + 3) #define MSG_CLPBRD_FORMAT_ERROR (RC_DOCHDL_BEGIN + 4) #define MSG_UPDATE_NEW_GLOS_FMT (RC_DOCHDL_BEGIN + 5) diff --git a/sw/source/ui/dbui/mailmergechildwindow.src b/sw/source/ui/dbui/mailmergechildwindow.src index fd0e59fb0623..6d9f0bc49272 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.src +++ b/sw/source/ui/dbui/mailmergechildwindow.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mailmergechildwindow.src,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.240.1 $ * * This file is part of OpenOffice.org. * @@ -251,7 +251,7 @@ ModalDialog DLG_MM_SENDWARNING Pos = MAP_APPFONT ( 40 , 6 ) ; Size = MAP_APPFONT ( 170 , 30 ) ; WordBreak = TRUE; - Text[ en-US ] = "The following error occured:"; + Text[ en-US ] = "The following error occurred:"; }; FixedText FT_DETAILS { diff --git a/sw/source/ui/dialog/dialog.src b/sw/source/ui/dialog/dialog.src index 985dccf842e7..5f323732dfd5 100644 --- a/sw/source/ui/dialog/dialog.src +++ b/sw/source/ui/dialog/dialog.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dialog.src,v $ - * $Revision: 1.30 $ + * $Revision: 1.30.240.1 $ * * This file is part of OpenOffice.org. * @@ -43,16 +43,9 @@ String STR_LINKEDIT_TEXT /* ### ACHTUNG: Neuer Text in Resource? Verknüpfungen bearbeiten : Verkn³pfungen bearbeiten */ Text [ en-US ] = "Edit links" ; }; -String STR_PATH_NOT_FOUND1 +String STR_PATH_NOT_FOUND { - /* ### ACHTUNG: Neuer Text in Resource? Das Verzeichnis ' : Das Verzeichnis '' */ - Text [ en-US ] = "The directory '" ; -}; -String STR_PATH_NOT_FOUND2 -{ - /* ### ACHTUNG: Neuer Text in Resource? ' existiert nicht. : '' existiert nicht. */ - /* ### ACHTUNG: Neuer Text in Resource? ' existiert nicht. : '' existiert nicht. */ - Text [ en-US ] = "' does not exist." ; + Text [ en-US ] = "The directory '%1' does not exist." ; }; String STR_FLT_SGV { diff --git a/sw/source/ui/dochdl/dochdl.src b/sw/source/ui/dochdl/dochdl.src index a1c11627ff46..4c201bec02b9 100644 --- a/sw/source/ui/dochdl/dochdl.src +++ b/sw/source/ui/dochdl/dochdl.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dochdl.src,v $ - * $Revision: 1.48 $ + * $Revision: 1.48.240.1 $ * * This file is part of OpenOffice.org. * @@ -33,15 +33,10 @@ #include "globals.hrc" -String STR_NOGLOS1 +String STR_NOGLOS { - Text [ en-US ] = "AutoText for Shortcut '" ; + Text [ en-US ] = "AutoText for Shortcut '%1' not found." ; }; -String STR_NOGLOS2 -{ - Text [ en-US ] = "' not found." ; -}; - String STR_NO_TABLE { Text [ en-US ] = "A table cannot be inserted into another table. However, you can paste the data into the document when the cursor is not in a table."; diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index ad394e7a9c85..49ed555cfd66 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gloshdl.cxx,v $ - * $Revision: 1.32 $ + * $Revision: 1.32.240.1 $ * * This file is part of OpenOffice.org. * @@ -647,10 +647,10 @@ BOOL SwGlossaryHdl::Expand( const String& rShortName, } else { - String aTmp( SW_RES(STR_NOGLOS1)); - aTmp += aShortName; - aTmp += SW_RESSTR(STR_NOGLOS2); + String aTmp( SW_RES(STR_NOGLOS)); + aTmp.SearchAndReplaceAscii("%1", aShortName); InfoBox( pWrtShell->GetView().GetWindow(), aTmp ).Execute(); + } } diff --git a/sw/source/ui/frmdlg/frmpage.src b/sw/source/ui/frmdlg/frmpage.src index f44c84f3a2f0..eb1e06090a08 100644 --- a/sw/source/ui/frmdlg/frmpage.src +++ b/sw/source/ui/frmdlg/frmpage.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: frmpage.src,v $ - * $Revision: 1.67 $ + * $Revision: 1.67.240.1 $ * * This file is part of OpenOffice.org. * @@ -330,8 +330,8 @@ TabPage TP_FRM_STD }; PushButton BT_REALSIZE { - Pos = MAP_APPFONT ( 55 , 86 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 35 , 86 ) ; + Size = MAP_APPFONT ( 70 , 14 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "~Original Size" ; diff --git a/sw/source/ui/misc/insrule.src b/sw/source/ui/misc/insrule.src index 006f745df269..9c0767f15eca 100644 --- a/sw/source/ui/misc/insrule.src +++ b/sw/source/ui/misc/insrule.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: insrule.src,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.240.1 $ * * This file is part of OpenOffice.org. * @@ -76,7 +76,7 @@ ModalDialog DLG_INSERT_RULER { Text [ en-US ] = "Plain" ; }; - Text [ en-US ] = "Insert Horizontal Ruler" ; + Text [ en-US ] = "Insert Horizontal Rule" ; }; diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src index 2023263856c7..3eec84232ba1 100644 --- a/sw/source/ui/table/convert.src +++ b/sw/source/ui/table/convert.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: convert.src,v $ - * $Revision: 1.29 $ + * $Revision: 1.29.240.1 $ * * This file is part of OpenOffice.org. * @@ -111,7 +111,7 @@ ModalDialog DLG_CONV_TEXT_TABLE { Pos = MAP_APPFONT ( 125 , 113 ) ; Size = MAP_APPFONT ( 66 , 10 ) ; - Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; + Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/table/instable.src b/sw/source/ui/table/instable.src index 5a64b0b6df45..ca5680ebf494 100644 --- a/sw/source/ui/table/instable.src +++ b/sw/source/ui/table/instable.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: instable.src,v $ - * $Revision: 1.32 $ + * $Revision: 1.32.240.1 $ * * This file is part of OpenOffice.org. * @@ -122,7 +122,7 @@ ModalDialog DLG_INSERT_TABLE { Pos = MAP_APPFONT ( 30 , 105 ) ; Size = MAP_APPFONT ( 95 , 10 ) ; - Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; + Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/table/tabledlg.src b/sw/source/ui/table/tabledlg.src index b6242c8e46a9..56fed8214c33 100644 --- a/sw/source/ui/table/tabledlg.src +++ b/sw/source/ui/table/tabledlg.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: tabledlg.src,v $ - * $Revision: 1.38 $ + * $Revision: 1.38.66.1 $ * * This file is part of OpenOffice.org. * @@ -679,7 +679,7 @@ TabPage TP_TABLE_TEXTFLOW { Pos = MAP_APPFONT ( 31 , 114 ) ; Size = MAP_APPFONT ( 95 , 10 ) ; - Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; + Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/uiview/view.hrc b/sw/source/ui/uiview/view.hrc index dabfedc3466a..5d192583b902 100644 --- a/sw/source/ui/uiview/view.hrc +++ b/sw/source/ui/uiview/view.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: view.hrc,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.240.1 $ * * This file is part of OpenOffice.org. * @@ -39,8 +39,6 @@ // STR ------------------------------------------------------------------- -#define STR_NOGLOS1 (RC_VIEW_BEGIN + 1) -#define STR_NOGLOS2 (RC_VIEW_BEGIN + 2) #define STR_NUM_LEVEL (RC_VIEW_BEGIN + 3) #define STR_ERROR_NOLANG (RC_VIEW_BEGIN + 6) diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src index b3c4cf968e94..e9b722d804ad 100644 --- a/sw/source/ui/uiview/view.src +++ b/sw/source/ui/uiview/view.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: view.src,v $ - * $Revision: 1.52 $ + * $Revision: 1.52.110.1 $ * * This file is part of OpenOffice.org. * @@ -136,18 +136,6 @@ InfoBox MSG_SCAN_NOSOURCE { Message [ en-US ] = "Source not specified." ; }; -String STR_NOGLOS1 -{ - Text [ en-US ] = "AutoText for Shortcut '" ; -}; -String STR_NOGLOS2 -{ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - Text [ en-US ] = "' not found." ; -}; String STR_NUM_LEVEL { Text [ en-US ] = "Level " ; diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src index a476d35cb643..2882146a8986 100644 --- a/sw/source/ui/utlui/utlui.src +++ b/sw/source/ui/utlui/utlui.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: utlui.src,v $ - * $Revision: 1.53 $ + * $Revision: 1.53.240.1 $ * * This file is part of OpenOffice.org. * @@ -54,7 +54,7 @@ Resource RID_SHELLRES_AUTOFMTSTRS }; String STR_AUTOFMTREDL_TYPO+1 { - Text [ en-US ] = "Replace \"standard\" quotes with %1custom%2 quotes" ; + Text [ en-US ] = "Replace \"standard\" quotes with %1 \bcustom%2 quotes" ; }; String STR_AUTOFMTREDL_USER_STYLE+1 { -- cgit v1.2.3 From 8a8313868fdc4d5f0dcfea2e24810aa8460d200b Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Wed, 26 Nov 2008 08:18:20 +0000 Subject: override wrong commit --- sw/inc/dialog.hrc | 5 +++-- sw/inc/dochdl.hrc | 5 +++-- sw/source/ui/dbui/mailmergechildwindow.src | 4 ++-- sw/source/ui/dialog/dialog.src | 13 ++++++++++--- sw/source/ui/dochdl/dochdl.src | 11 ++++++++--- sw/source/ui/dochdl/gloshdl.cxx | 8 ++++---- sw/source/ui/frmdlg/frmpage.src | 6 +++--- sw/source/ui/misc/insrule.src | 4 ++-- sw/source/ui/table/convert.src | 4 ++-- sw/source/ui/table/instable.src | 4 ++-- sw/source/ui/table/tabledlg.src | 4 ++-- sw/source/ui/uiview/view.src | 14 +++++++++++++- sw/source/ui/utlui/utlui.src | 4 ++-- 13 files changed, 56 insertions(+), 30 deletions(-) diff --git a/sw/inc/dialog.hrc b/sw/inc/dialog.hrc index deed99451d94..7e9b8b3389b9 100644 --- a/sw/inc/dialog.hrc +++ b/sw/inc/dialog.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dialog.hrc,v $ - * $Revision: 1.7.240.1 $ + * $Revision: 1.7 $ * * This file is part of OpenOffice.org. * @@ -54,7 +54,8 @@ #define STR_LINKEDIT_TEXT (RC_DIALOG_BEGIN + 1) #define STR_CLOSELINKMSG (RC_DIALOG_BEGIN + 3) -#define STR_PATH_NOT_FOUND (RC_DIALOG_BEGIN + 4) +#define STR_PATH_NOT_FOUND1 (RC_DIALOG_BEGIN + 4) +#define STR_PATH_NOT_FOUND2 (RC_DIALOG_BEGIN + 5) #define STR_FLT_SGV (RC_DIALOG_BEGIN + 8) diff --git a/sw/inc/dochdl.hrc b/sw/inc/dochdl.hrc index 1ee4b68efe10..29beaa022c92 100644 --- a/sw/inc/dochdl.hrc +++ b/sw/inc/dochdl.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dochdl.hrc,v $ - * $Revision: 1.5.240.1 $ + * $Revision: 1.5 $ * * This file is part of OpenOffice.org. * @@ -33,7 +33,8 @@ #include "rcid.hrc" -#define STR_NOGLOS (RC_DOCHDL_BEGIN + 1) +#define STR_NOGLOS1 (RC_DOCHDL_BEGIN + 1) +#define STR_NOGLOS2 (RC_DOCHDL_BEGIN + 2) #define MSG_ERR_INSERT_GLOS (RC_DOCHDL_BEGIN + 3) #define MSG_CLPBRD_FORMAT_ERROR (RC_DOCHDL_BEGIN + 4) #define MSG_UPDATE_NEW_GLOS_FMT (RC_DOCHDL_BEGIN + 5) diff --git a/sw/source/ui/dbui/mailmergechildwindow.src b/sw/source/ui/dbui/mailmergechildwindow.src index 6d9f0bc49272..fd0e59fb0623 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.src +++ b/sw/source/ui/dbui/mailmergechildwindow.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mailmergechildwindow.src,v $ - * $Revision: 1.11.240.1 $ + * $Revision: 1.11 $ * * This file is part of OpenOffice.org. * @@ -251,7 +251,7 @@ ModalDialog DLG_MM_SENDWARNING Pos = MAP_APPFONT ( 40 , 6 ) ; Size = MAP_APPFONT ( 170 , 30 ) ; WordBreak = TRUE; - Text[ en-US ] = "The following error occurred:"; + Text[ en-US ] = "The following error occured:"; }; FixedText FT_DETAILS { diff --git a/sw/source/ui/dialog/dialog.src b/sw/source/ui/dialog/dialog.src index 5f323732dfd5..985dccf842e7 100644 --- a/sw/source/ui/dialog/dialog.src +++ b/sw/source/ui/dialog/dialog.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dialog.src,v $ - * $Revision: 1.30.240.1 $ + * $Revision: 1.30 $ * * This file is part of OpenOffice.org. * @@ -43,9 +43,16 @@ String STR_LINKEDIT_TEXT /* ### ACHTUNG: Neuer Text in Resource? Verknüpfungen bearbeiten : Verkn³pfungen bearbeiten */ Text [ en-US ] = "Edit links" ; }; -String STR_PATH_NOT_FOUND +String STR_PATH_NOT_FOUND1 { - Text [ en-US ] = "The directory '%1' does not exist." ; + /* ### ACHTUNG: Neuer Text in Resource? Das Verzeichnis ' : Das Verzeichnis '' */ + Text [ en-US ] = "The directory '" ; +}; +String STR_PATH_NOT_FOUND2 +{ + /* ### ACHTUNG: Neuer Text in Resource? ' existiert nicht. : '' existiert nicht. */ + /* ### ACHTUNG: Neuer Text in Resource? ' existiert nicht. : '' existiert nicht. */ + Text [ en-US ] = "' does not exist." ; }; String STR_FLT_SGV { diff --git a/sw/source/ui/dochdl/dochdl.src b/sw/source/ui/dochdl/dochdl.src index 4c201bec02b9..a1c11627ff46 100644 --- a/sw/source/ui/dochdl/dochdl.src +++ b/sw/source/ui/dochdl/dochdl.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dochdl.src,v $ - * $Revision: 1.48.240.1 $ + * $Revision: 1.48 $ * * This file is part of OpenOffice.org. * @@ -33,10 +33,15 @@ #include "globals.hrc" -String STR_NOGLOS +String STR_NOGLOS1 { - Text [ en-US ] = "AutoText for Shortcut '%1' not found." ; + Text [ en-US ] = "AutoText for Shortcut '" ; }; +String STR_NOGLOS2 +{ + Text [ en-US ] = "' not found." ; +}; + String STR_NO_TABLE { Text [ en-US ] = "A table cannot be inserted into another table. However, you can paste the data into the document when the cursor is not in a table."; diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index 49ed555cfd66..ad394e7a9c85 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gloshdl.cxx,v $ - * $Revision: 1.32.240.1 $ + * $Revision: 1.32 $ * * This file is part of OpenOffice.org. * @@ -647,10 +647,10 @@ BOOL SwGlossaryHdl::Expand( const String& rShortName, } else { - String aTmp( SW_RES(STR_NOGLOS)); - aTmp.SearchAndReplaceAscii("%1", aShortName); + String aTmp( SW_RES(STR_NOGLOS1)); + aTmp += aShortName; + aTmp += SW_RESSTR(STR_NOGLOS2); InfoBox( pWrtShell->GetView().GetWindow(), aTmp ).Execute(); - } } diff --git a/sw/source/ui/frmdlg/frmpage.src b/sw/source/ui/frmdlg/frmpage.src index eb1e06090a08..f44c84f3a2f0 100644 --- a/sw/source/ui/frmdlg/frmpage.src +++ b/sw/source/ui/frmdlg/frmpage.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: frmpage.src,v $ - * $Revision: 1.67.240.1 $ + * $Revision: 1.67 $ * * This file is part of OpenOffice.org. * @@ -330,8 +330,8 @@ TabPage TP_FRM_STD }; PushButton BT_REALSIZE { - Pos = MAP_APPFONT ( 35 , 86 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; + Pos = MAP_APPFONT ( 55 , 86 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "~Original Size" ; diff --git a/sw/source/ui/misc/insrule.src b/sw/source/ui/misc/insrule.src index 9c0767f15eca..006f745df269 100644 --- a/sw/source/ui/misc/insrule.src +++ b/sw/source/ui/misc/insrule.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: insrule.src,v $ - * $Revision: 1.21.240.1 $ + * $Revision: 1.21 $ * * This file is part of OpenOffice.org. * @@ -76,7 +76,7 @@ ModalDialog DLG_INSERT_RULER { Text [ en-US ] = "Plain" ; }; - Text [ en-US ] = "Insert Horizontal Rule" ; + Text [ en-US ] = "Insert Horizontal Ruler" ; }; diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src index 3eec84232ba1..2023263856c7 100644 --- a/sw/source/ui/table/convert.src +++ b/sw/source/ui/table/convert.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: convert.src,v $ - * $Revision: 1.29.240.1 $ + * $Revision: 1.29 $ * * This file is part of OpenOffice.org. * @@ -111,7 +111,7 @@ ModalDialog DLG_CONV_TEXT_TABLE { Pos = MAP_APPFONT ( 125 , 113 ) ; Size = MAP_APPFONT ( 66 , 10 ) ; - Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; + Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/table/instable.src b/sw/source/ui/table/instable.src index ca5680ebf494..5a64b0b6df45 100644 --- a/sw/source/ui/table/instable.src +++ b/sw/source/ui/table/instable.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: instable.src,v $ - * $Revision: 1.32.240.1 $ + * $Revision: 1.32 $ * * This file is part of OpenOffice.org. * @@ -122,7 +122,7 @@ ModalDialog DLG_INSERT_TABLE { Pos = MAP_APPFONT ( 30 , 105 ) ; Size = MAP_APPFONT ( 95 , 10 ) ; - Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; + Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/table/tabledlg.src b/sw/source/ui/table/tabledlg.src index 56fed8214c33..b6242c8e46a9 100644 --- a/sw/source/ui/table/tabledlg.src +++ b/sw/source/ui/table/tabledlg.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: tabledlg.src,v $ - * $Revision: 1.38.66.1 $ + * $Revision: 1.38 $ * * This file is part of OpenOffice.org. * @@ -679,7 +679,7 @@ TabPage TP_TABLE_TEXTFLOW { Pos = MAP_APPFONT ( 31 , 114 ) ; Size = MAP_APPFONT ( 95 , 10 ) ; - Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; + Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src index e9b722d804ad..b3c4cf968e94 100644 --- a/sw/source/ui/uiview/view.src +++ b/sw/source/ui/uiview/view.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: view.src,v $ - * $Revision: 1.52.110.1 $ + * $Revision: 1.52 $ * * This file is part of OpenOffice.org. * @@ -136,6 +136,18 @@ InfoBox MSG_SCAN_NOSOURCE { Message [ en-US ] = "Source not specified." ; }; +String STR_NOGLOS1 +{ + Text [ en-US ] = "AutoText for Shortcut '" ; +}; +String STR_NOGLOS2 +{ + /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ + /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ + /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ + /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ + Text [ en-US ] = "' not found." ; +}; String STR_NUM_LEVEL { Text [ en-US ] = "Level " ; diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src index 2882146a8986..a476d35cb643 100644 --- a/sw/source/ui/utlui/utlui.src +++ b/sw/source/ui/utlui/utlui.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: utlui.src,v $ - * $Revision: 1.53.240.1 $ + * $Revision: 1.53 $ * * This file is part of OpenOffice.org. * @@ -54,7 +54,7 @@ Resource RID_SHELLRES_AUTOFMTSTRS }; String STR_AUTOFMTREDL_TYPO+1 { - Text [ en-US ] = "Replace \"standard\" quotes with %1 \bcustom%2 quotes" ; + Text [ en-US ] = "Replace \"standard\" quotes with %1custom%2 quotes" ; }; String STR_AUTOFMTREDL_USER_STYLE+1 { -- cgit v1.2.3 From a38d55b7fe151da64f9e6b14e56fc1b6888ca573 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Wed, 26 Nov 2008 08:19:39 +0000 Subject: override wrong commit --- sw/source/ui/uiview/view.hrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sw/source/ui/uiview/view.hrc b/sw/source/ui/uiview/view.hrc index 5d192583b902..dabfedc3466a 100644 --- a/sw/source/ui/uiview/view.hrc +++ b/sw/source/ui/uiview/view.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: view.hrc,v $ - * $Revision: 1.5.240.1 $ + * $Revision: 1.5 $ * * This file is part of OpenOffice.org. * @@ -39,6 +39,8 @@ // STR ------------------------------------------------------------------- +#define STR_NOGLOS1 (RC_VIEW_BEGIN + 1) +#define STR_NOGLOS2 (RC_VIEW_BEGIN + 2) #define STR_NUM_LEVEL (RC_VIEW_BEGIN + 3) #define STR_ERROR_NOLANG (RC_VIEW_BEGIN + 6) -- cgit v1.2.3 -- cgit v1.2.3 -- cgit v1.2.3 From 834af237fb233c59a8b9b070b12f61b5f94548be Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 3 Apr 2009 13:22:58 +0000 Subject: #i92516# preparations for new print UI --- starmath/inc/starmath.hrc | 2 + starmath/inc/unomodel.hxx | 2 + starmath/source/smres.src | 202 ++++--------------------------------------- starmath/source/unomodel.cxx | 193 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 213 insertions(+), 186 deletions(-) diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 6d117bcc9524..e957ee454bdf 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -103,6 +103,8 @@ #define RID_SYMBOLDIALOG (RID_APP_START + 8) #define RID_SYMDEFINEDIALOG (RID_APP_START + 9) #define RID_EXTRAOPTIONPAGE (RID_APP_START + 10) +#define RID_PRINTUIOPTIONS (RID_APP_START + 11) + #define RID_MATH_TOOLBOX (RID_APP_START + 50) // wegen #58705# entfernt //#define RID_DRAW_OBJECTBAR (RID_APP_START + 51) diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 2b3808ae4ca4..0bdd13ea0ac1 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -39,6 +39,7 @@ #include class SmFormat; +class PrintUIOptions; //----------------------------------------------------------------------------- class SmModel : public SfxBaseModel, @@ -46,6 +47,7 @@ class SmModel : public SfxBaseModel, public com::sun::star::lang::XServiceInfo, public com::sun::star::view::XRenderable { + PrintUIOptions* m_pPrintUIOptions; protected: virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); diff --git a/starmath/source/smres.src b/starmath/source/smres.src index 023fc1a483ce..e45cf2cc3711 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -3582,189 +3582,21 @@ String RID_MATH_TOOLBOX Text [ en-US ] = "Main Toolbar" ; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +StringArray RID_PRINTUIOPTIONS +{ + ItemList [en-US] = + { + <"Formula"; >; + < "Print options"; >; + < "~Title row"; >; + < "~Formula text"; >; + < "B~order"; >; + < "Print format"; >; + < "O~riginal size"; >; + < "Fit to ~page"; >; + < "~Scaling"; >; + < "Miscellaneous options"; >; + < "Ig~nore ~~ and ` at the end of the line"; >; + }; +}; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 8fc038f48e1a..57d9e909386f 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -80,6 +80,184 @@ using namespace ::com::sun::star::script; #define C2U(cChar) rtl::OUString::createFromAscii(cChar) +class PrintUIOptions +{ + ResStringArray m_aLocalizedStrings; + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal = NULL, + const Sequence< rtl::OUString >* i_pChoices = NULL, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); +public: + PrintUIOptions(); + + void addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ); +}; + +PrintUIOptions::PrintUIOptions() +: m_aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ) +{ +} + +Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal, + const Sequence< rtl::OUString >* i_pChoices, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry + ) +{ + Sequence< PropertyValue > aCtrl(6); + sal_Int32 nUsed = 0; + if( i_rTitle.getLength() ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); + aCtrl[nUsed++].Value = makeAny( i_rTitle ); + } + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); + aCtrl[nUsed++].Value = makeAny( i_rType ); + if( i_pVal ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pVal ); + } + if( i_pChoices ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pChoices ); + } + if( i_pDependsOnName ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pDependsOnName ); + if( i_nDependsOnEntry != -1 ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) ); + aCtrl[nUsed++].Value = makeAny( i_nDependsOnEntry ); + } + } + aCtrl.realloc( nUsed ); + return makeAny( aCtrl ); +} + +Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) +{ + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_bValue ); + return getUIControlOpt( i_rTitle, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, NULL, i_pDependsOnName, i_nDependsOnEntry ); +} + +Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) +{ + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_rChoices ); + return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); +} + +void PrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) +{ + // create sequence of print UI options + uno::Sequence< beans::PropertyValue > aUIOptions( 10 ); + + DBG_ASSERT( m_aLocalizedStrings.Count() >= 10, "resource incomplete" ); + if( m_aLocalizedStrings.Count() < 10 ) // bad resource ? + return; + + // create Section for formula (results in an extra tab page in dialog) + aUIOptions[0].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 0 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + + // create subgroup for print options + aUIOptions[1].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 1 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a bool option for title row + aUIOptions[2].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), + sal_True ); + // create a bool option for formula text + aUIOptions[3].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), + sal_True ); + // create a bool option for border + aUIOptions[4].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); + + // create subgroup for print format + aUIOptions[5].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a radio button group for print format + Sequence< rtl::OUString > aChoices( 3 ); + aChoices[0] = m_aLocalizedStrings.GetString( 6 ); + aChoices[1] = m_aLocalizedStrings.GetString( 7 ); + aChoices[2] = m_aLocalizedStrings.GetString( 8 ); + OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ); + aUIOptions[6].Value = getUIControlOpt( rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ), + aChoices + ); + + // create a numeric box for scale dependent on PrintFormat = "Scaling" + PropertyValue aVal; + aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ); + aVal.Value = makeAny( sal_Int32( 100 ) ); + aUIOptions[ 7 ].Value = getUIControlOpt( rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), + &aVal, + NULL, + &aPrintFormatProp, + 2 ); + + // create subgroup for misc options + aUIOptions[8].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 9 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a bool option for ignore spacing + aUIOptions[9].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); + + sal_Int32 nLen = io_rProps.getLength(); + io_rProps.realloc( nLen+1 ); + io_rProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); + io_rProps[nLen].Value = uno::makeAny( aUIOptions ); +} + + + + //////////////////////////////////////// // // class SmModel @@ -230,11 +408,14 @@ PropertySetInfo * lcl_createModelPropertyInfo () SmModel::SmModel( SfxObjectShell *pObjSh ) : SfxBaseModel(pObjSh) , PropertySetHelper ( lcl_createModelPropertyInfo () ) +, m_pPrintUIOptions( NULL ) + { } //----------------------------------------------------------------------- SmModel::~SmModel() throw () { + delete m_pPrintUIOptions; } /*-- 28.03.00 14:18:17--------------------------------------------------- @@ -860,6 +1041,9 @@ sal_Int32 SAL_CALL SmModel::getRendererCount( throw (IllegalArgumentException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new PrintUIOptions(); + return 1; } @@ -886,7 +1070,6 @@ static Size lcl_GuessPaperSize() return aRes; } - uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( sal_Int32 nRenderer, const uno::Any& /*rSelection*/, @@ -895,6 +1078,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( { ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new PrintUIOptions(); + if (0 != nRenderer) throw IllegalArgumentException(); @@ -918,6 +1104,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; + m_pPrintUIOptions->addPrintUIOptions( aRenderer ); + return aRenderer; } @@ -929,6 +1117,9 @@ void SAL_CALL SmModel::render( { ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new PrintUIOptions(); + if (0 != nRenderer) throw IllegalArgumentException(); -- cgit v1.2.3 From 05f54edb99508ebc6ec1591b31246a4a89ac5aa2 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 3 Apr 2009 13:59:03 +0000 Subject: #i92516# preparations for new print UI --- starmath/source/unomodel.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 57d9e909386f..9d068ddbc7de 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -103,6 +103,7 @@ class PrintUIOptions const rtl::OUString& i_rType, const rtl::OUString& i_rProperty, const Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, const rtl::OUString* i_pDependsOnName = NULL, sal_Int32 i_nDependsOnEntry = -1 ); @@ -174,12 +175,13 @@ Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rType, const rtl::OUString& i_rProperty, const Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, const rtl::OUString* i_pDependsOnName, sal_Int32 i_nDependsOnEntry ) { PropertyValue aVal; aVal.Name = i_rProperty; - aVal.Value = makeAny( i_rChoices ); + aVal.Value = makeAny( i_nValue ); return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); } @@ -226,7 +228,7 @@ void PrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& i aUIOptions[6].Value = getUIControlOpt( rtl::OUString(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ), - aChoices + aChoices, 0 ); // create a numeric box for scale dependent on PrintFormat = "Scaling" -- cgit v1.2.3 From 313505000dd5252b55a106733df5eecb53c3a548 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 3 Apr 2009 14:47:31 +0000 Subject: #i92516# preparations for new print UI --- sw/inc/globals.hrc | 1 + sw/inc/unotxdoc.hxx | 3 + sw/source/ui/config/optdlg.src | 31 ++++++ sw/source/ui/uno/unotxdoc.cxx | 245 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 279 insertions(+), 1 deletion(-) diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index 0dc7f4e06be0..390b243cde03 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -54,6 +54,7 @@ #define STR_DOC_STAT (RC_GLOBALS_BEGIN + 10) #define STR_PAGE (RC_GLOBALS_BEGIN + 14) +#define STR_PRINTOPTUI (RC_GLOBALS_BEGIN + 15) //EventStrings diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 7c0f8af1b072..a5d840c1ac2b 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -123,6 +123,7 @@ class SwXDrawPage; class SwUnoCrsr; class SwXDocumentPropertyHelper; class SfxViewFrame; +class SwPrintUIOptions; typedef UnoActionContext* UnoActionContextPtr; SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) @@ -216,6 +217,8 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xPropertyHelper; SwXDocumentPropertyHelper* pPropertyHelper; + SwPrintUIOptions* m_pPrintUIOptions; + void GetBodyText(); void GetNumberFormatter(); diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 763e5e82d62e..343d4daa389a 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -935,3 +935,34 @@ TabPage TP_OPTSHDWCRSR }; }; + +StringArray STR_PRINTOPTUI +{ + ItemList [en-US] = + { + < "Contents"; >; + < "~Graphics"; >; + < "~Tables"; >; + < "Dra~wings"; >; + < "Control~s"; >; + < "Ba~ckground"; >; + < "Print blac~k"; >; + < "Hidden te~xt"; >; + < "Text ~placeholder"; >; + < "~Notes"; >; + < "None"; >; + < "Notes only"; >; + < " at end of document"; >; + < " at end of page"; >; + < "Page settings"; >; + < "~Left pages"; >; + < "~Right pages"; >; + < "Re~versed"; >; + < "Broch~ure"; >; + < "Right to Left"; >; + < "Other"; >; + < "Print ~automatically inserted blank pages"; >; + < "~Paper tray from printer settings"; >; + }; +}; + diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 9479350620b3..a4dffcd966aa 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -79,6 +79,7 @@ #include #include #include +#include #include #include @@ -174,6 +175,232 @@ using ::osl::FileBase; /****************************************************************************** * ******************************************************************************/ + +class SwPrintUIOptions +{ + ResStringArray m_aLocalizedStrings; + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal = NULL, + const Sequence< rtl::OUString >* i_pChoices = NULL, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); +public: + SwPrintUIOptions(); + + void addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ); +}; + +SwPrintUIOptions::SwPrintUIOptions() +: m_aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ) +{ +} + +Any SwPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal, + const Sequence< rtl::OUString >* i_pChoices, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry + ) +{ + Sequence< PropertyValue > aCtrl(6); + sal_Int32 nUsed = 0; + if( i_rTitle.getLength() ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); + aCtrl[nUsed++].Value = makeAny( i_rTitle ); + } + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); + aCtrl[nUsed++].Value = makeAny( i_rType ); + if( i_pVal ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pVal ); + } + if( i_pChoices ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pChoices ); + } + if( i_pDependsOnName ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pDependsOnName ); + if( i_nDependsOnEntry != -1 ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) ); + aCtrl[nUsed++].Value = makeAny( i_nDependsOnEntry ); + } + } + aCtrl.realloc( nUsed ); + return makeAny( aCtrl ); +} + +Any SwPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) +{ + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_bValue ); + return getUIControlOpt( i_rTitle, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, NULL, i_pDependsOnName, i_nDependsOnEntry ); +} + +Any SwPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) +{ + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_nValue ); + return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); +} + + +void SwPrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) +{ + // create sequence of print UI options + uno::Sequence< beans::PropertyValue > aUIOptions( 19 ); + + DBG_ASSERT( m_aLocalizedStrings.Count() >= 23, "resource incomplete" ); + if( m_aLocalizedStrings.Count() < 23 ) // bad resource ? + return; + + // create Section for Contents (results in an extra tab page in dialog) + aUIOptions[0].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 0 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + + // create a bool option for graphics + aUIOptions[1].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 1 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), + sal_True ); + // create a bool option for tables + aUIOptions[2].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), + sal_True ); + + // create a bool option for drawings + aUIOptions[3].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), + sal_True ); + + // create a bool option for controls + aUIOptions[4].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), + sal_True ); + + // create a bool option for background + aUIOptions[5].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), + sal_True ); + + // create a bool option for black + aUIOptions[6].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 6 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), + sal_False ); + + // create a bool option for hidden text + aUIOptions[7].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 7 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), + sal_False ); + + // create a bool option for place holder + aUIOptions[8].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 8 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), + sal_False ); + + // create a list box for notes content + Sequence< rtl::OUString > aChoices( 4 ); + aChoices[0] = m_aLocalizedStrings.GetString( 10 ); + aChoices[1] = m_aLocalizedStrings.GetString( 11 ); + aChoices[2] = m_aLocalizedStrings.GetString( 12 ); + aChoices[3] = m_aLocalizedStrings.GetString( 13 ); + aUIOptions[9].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 9 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), + aChoices, + 0 + ); + + // create Section for Page settings (results in an extra tab page in dialog) + aUIOptions[10].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 14 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + + // create a bool option for left pages + aUIOptions[11].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 15 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), + sal_True ); + + // create a bool option for right pages + aUIOptions[12].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 16 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), + sal_True ); + + // create a bool option for reversed order (solve in vcl ?) + aUIOptions[13].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 17 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), + sal_False ); + + // create a bool option for brochure + OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); + aUIOptions[14].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 18 ), + aBrochurePropertyName, + sal_False ); + + // create a bool option for brochure RTL dependent on brochure + aUIOptions[15].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 19 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), + sal_False, + &aBrochurePropertyName + ); + + // create subgroup for misc options + aUIOptions[16].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 20 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a bool option for blank pages + aUIOptions[17].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 21 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + sal_True ); + + // create a bool option for paper tray + aUIOptions[18].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 22 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), + sal_False ); + + sal_Int32 nLen = io_rProps.getLength(); + io_rProps.realloc( nLen+1 ); + io_rProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); + io_rProps[nLen].Value = uno::makeAny( aUIOptions ); +} + + + SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc) { SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollName ); @@ -360,7 +587,8 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : pxXLineNumberingProperties(0), pxLinkTargetSupplier(0), pxXRedlines(0), - m_pHiddenViewFrame(0) + m_pHiddenViewFrame(0), + m_pPrintUIOptions( NULL ) { } /*-- 18.12.98 11:53:00--------------------------------------------------- @@ -375,6 +603,7 @@ SwXTextDocument::~SwXTextDocument() xNumFmtAgg->setDelegator(x0); xNumFmtAgg = 0; } + delete m_pPrintUIOptions; } @@ -2604,6 +2833,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); + + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new SwPrintUIOptions(); + SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection ); if (!pDoc) @@ -2650,6 +2883,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); + + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new SwPrintUIOptions(); + SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection ); if (!pDoc) @@ -2679,6 +2916,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; + m_pPrintUIOptions->addPrintUIOptions( aRenderer ); + return aRenderer; } /* -----------------------------28.10.02 16:00-------------------------------- @@ -2719,6 +2958,10 @@ void SAL_CALL SwXTextDocument::render( ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); + + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new SwPrintUIOptions(); + SfxViewShell *pView = GuessViewShell(); SwDoc *pDoc = GetRenderDoc( pView, rSelection ); if (!pDoc || !pView) -- cgit v1.2.3 From 1fbd16c4069cf7cdcc9489374596f6c9eb378f1c Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 3 Apr 2009 14:51:44 +0000 Subject: #i92516# preparations for new print UI --- starmath/inc/unomodel.hxx | 4 ++-- starmath/source/unomodel.cxx | 50 ++++++++++++++++++++++---------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 0bdd13ea0ac1..2e0ed24dd1fb 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -39,7 +39,7 @@ #include class SmFormat; -class PrintUIOptions; +class SmPrintUIOptions; //----------------------------------------------------------------------------- class SmModel : public SfxBaseModel, @@ -47,7 +47,7 @@ class SmModel : public SfxBaseModel, public com::sun::star::lang::XServiceInfo, public com::sun::star::view::XRenderable { - PrintUIOptions* m_pPrintUIOptions; + SmPrintUIOptions* m_pPrintUIOptions; protected: virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 9d068ddbc7de..971f9c5f2d52 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -80,7 +80,7 @@ using namespace ::com::sun::star::script; #define C2U(cChar) rtl::OUString::createFromAscii(cChar) -class PrintUIOptions +class SmPrintUIOptions { ResStringArray m_aLocalizedStrings; @@ -108,22 +108,22 @@ class PrintUIOptions sal_Int32 i_nDependsOnEntry = -1 ); public: - PrintUIOptions(); + SmPrintUIOptions(); void addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ); }; -PrintUIOptions::PrintUIOptions() +SmPrintUIOptions::SmPrintUIOptions() : m_aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ) { } -Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const PropertyValue* i_pVal, - const Sequence< rtl::OUString >* i_pChoices, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry +Any SmPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal, + const Sequence< rtl::OUString >* i_pChoices, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) { Sequence< PropertyValue > aCtrl(6); @@ -159,11 +159,11 @@ Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, return makeAny( aCtrl ); } -Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rProperty, - sal_Bool i_bValue, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry ) +Any SmPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) { PropertyValue aVal; aVal.Name = i_rProperty; @@ -171,13 +171,13 @@ Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, return getUIControlOpt( i_rTitle, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, NULL, i_pDependsOnName, i_nDependsOnEntry ); } -Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const rtl::OUString& i_rProperty, - const Sequence< rtl::OUString >& i_rChoices, - sal_Int32 i_nValue, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry ) +Any SmPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) { PropertyValue aVal; aVal.Name = i_rProperty; @@ -185,7 +185,7 @@ Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); } -void PrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) +void SmPrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) { // create sequence of print UI options uno::Sequence< beans::PropertyValue > aUIOptions( 10 ); @@ -1044,7 +1044,7 @@ sal_Int32 SAL_CALL SmModel::getRendererCount( { ::vos::OGuard aGuard(Application::GetSolarMutex()); if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new PrintUIOptions(); + m_pPrintUIOptions = new SmPrintUIOptions(); return 1; } @@ -1081,7 +1081,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( ::vos::OGuard aGuard(Application::GetSolarMutex()); if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new PrintUIOptions(); + m_pPrintUIOptions = new SmPrintUIOptions(); if (0 != nRenderer) throw IllegalArgumentException(); @@ -1120,7 +1120,7 @@ void SAL_CALL SmModel::render( ::vos::OGuard aGuard(Application::GetSolarMutex()); if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new PrintUIOptions(); + m_pPrintUIOptions = new SmPrintUIOptions(); if (0 != nRenderer) throw IllegalArgumentException(); -- cgit v1.2.3 From 1777b5a68513f7cbfaa239acf16bcc76a49b448c Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 15 Apr 2009 19:11:23 +0000 Subject: #i92516# vcl helper for new print ui options --- starmath/source/unomodel.cxx | 184 +++++++------------------------- sw/source/ui/uno/unotxdoc.cxx | 242 ++++++++++++------------------------------ 2 files changed, 107 insertions(+), 319 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 971f9c5f2d52..03639668573f 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -80,181 +80,73 @@ using namespace ::com::sun::star::script; #define C2U(cChar) rtl::OUString::createFromAscii(cChar) -class SmPrintUIOptions +class SmPrintUIOptions : public vcl::PrinterOptionsHelper { - ResStringArray m_aLocalizedStrings; - - Any getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const PropertyValue* i_pVal = NULL, - const Sequence< rtl::OUString >* i_pChoices = NULL, - const rtl::OUString* i_pDependsOnName = NULL, - sal_Int32 i_nDependsOnEntry = -1 - ); - - Any getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rProperty, - sal_Bool i_bValue, - const rtl::OUString* i_pDependsOnName = NULL, - sal_Int32 i_nDependsOnEntry = -1 - ); - - Any getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const rtl::OUString& i_rProperty, - const Sequence< rtl::OUString >& i_rChoices, - sal_Int32 i_nValue, - const rtl::OUString* i_pDependsOnName = NULL, - sal_Int32 i_nDependsOnEntry = -1 - ); public: SmPrintUIOptions(); - - void addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ); }; SmPrintUIOptions::SmPrintUIOptions() -: m_aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ) -{ -} - -Any SmPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const PropertyValue* i_pVal, - const Sequence< rtl::OUString >* i_pChoices, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry - ) -{ - Sequence< PropertyValue > aCtrl(6); - sal_Int32 nUsed = 0; - if( i_rTitle.getLength() ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); - aCtrl[nUsed++].Value = makeAny( i_rTitle ); - } - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); - aCtrl[nUsed++].Value = makeAny( i_rType ); - if( i_pVal ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) ); - aCtrl[nUsed++].Value = makeAny( *i_pVal ); - } - if( i_pChoices ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); - aCtrl[nUsed++].Value = makeAny( *i_pChoices ); - } - if( i_pDependsOnName ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) ); - aCtrl[nUsed++].Value = makeAny( *i_pDependsOnName ); - if( i_nDependsOnEntry != -1 ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) ); - aCtrl[nUsed++].Value = makeAny( i_nDependsOnEntry ); - } - } - aCtrl.realloc( nUsed ); - return makeAny( aCtrl ); -} - -Any SmPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rProperty, - sal_Bool i_bValue, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry ) -{ - PropertyValue aVal; - aVal.Name = i_rProperty; - aVal.Value = makeAny( i_bValue ); - return getUIControlOpt( i_rTitle, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, NULL, i_pDependsOnName, i_nDependsOnEntry ); -} - -Any SmPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const rtl::OUString& i_rProperty, - const Sequence< rtl::OUString >& i_rChoices, - sal_Int32 i_nValue, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry ) { - PropertyValue aVal; - aVal.Name = i_rProperty; - aVal.Value = makeAny( i_nValue ); - return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); -} + ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); + DBG_ASSERT( aLocalizedStrings.Count() >= 10, "resource incomplete" ); + if( aLocalizedStrings.Count() < 10 ) // bad resource ? + return; -void SmPrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) -{ // create sequence of print UI options - uno::Sequence< beans::PropertyValue > aUIOptions( 10 ); + m_aUIProperties.realloc( 10 ); - DBG_ASSERT( m_aLocalizedStrings.Count() >= 10, "resource incomplete" ); - if( m_aLocalizedStrings.Count() < 10 ) // bad resource ? - return; // create Section for formula (results in an extra tab page in dialog) - aUIOptions[0].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 0 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); // create subgroup for print options - aUIOptions[1].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 1 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ) ); // create a bool option for title row - aUIOptions[2].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 2 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), - sal_True ); + m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), + sal_True ); // create a bool option for formula text - aUIOptions[3].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), - sal_True ); + m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), + sal_True ); // create a bool option for border - aUIOptions[4].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 4 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), - sal_True ); + m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); // create subgroup for print format - aUIOptions[5].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + m_aUIProperties[5].Value = getUIControlOpt( aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); // create a radio button group for print format Sequence< rtl::OUString > aChoices( 3 ); - aChoices[0] = m_aLocalizedStrings.GetString( 6 ); - aChoices[1] = m_aLocalizedStrings.GetString( 7 ); - aChoices[2] = m_aLocalizedStrings.GetString( 8 ); + aChoices[0] = aLocalizedStrings.GetString( 6 ); + aChoices[1] = aLocalizedStrings.GetString( 7 ); + aChoices[2] = aLocalizedStrings.GetString( 8 ); OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ); - aUIOptions[6].Value = getUIControlOpt( rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ), - aChoices, 0 - ); + m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), + aPrintFormatProp, + aChoices, 0 + ); // create a numeric box for scale dependent on PrintFormat = "Scaling" - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ); - aVal.Value = makeAny( sal_Int32( 100 ) ); - aUIOptions[ 7 ].Value = getUIControlOpt( rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), - &aVal, - NULL, - &aPrintFormatProp, - 2 ); + m_aUIProperties[ 7 ].Value = getRangeControlOpt( rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ), + 100, // initial value + 10, // min value + 1000, // max value + &aPrintFormatProp, + 2 ); // create subgroup for misc options - aUIOptions[8].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 9 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + m_aUIProperties[8].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 9 ) ); // create a bool option for ignore spacing - aUIOptions[9].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 10 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), - sal_True ); - - sal_Int32 nLen = io_rProps.getLength(); - io_rProps.realloc( nLen+1 ); - io_rProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); - io_rProps[nLen].Value = uno::makeAny( aUIOptions ); + m_aUIProperties[9].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); } @@ -1106,7 +998,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; - m_pPrintUIOptions->addPrintUIOptions( aRenderer ); + m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); return aRenderer; } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index a4dffcd966aa..a4701db19285 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #ifndef _TOOLKIT_UNOHLP_HXX #include @@ -176,227 +177,122 @@ using ::osl::FileBase; * ******************************************************************************/ -class SwPrintUIOptions -{ - ResStringArray m_aLocalizedStrings; - - Any getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const PropertyValue* i_pVal = NULL, - const Sequence< rtl::OUString >* i_pChoices = NULL, - const rtl::OUString* i_pDependsOnName = NULL, - sal_Int32 i_nDependsOnEntry = -1 - ); - - Any getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rProperty, - sal_Bool i_bValue, - const rtl::OUString* i_pDependsOnName = NULL, - sal_Int32 i_nDependsOnEntry = -1 - ); - - Any getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const rtl::OUString& i_rProperty, - const Sequence< rtl::OUString >& i_rChoices, - sal_Int32 i_nValue, - const rtl::OUString* i_pDependsOnName = NULL, - sal_Int32 i_nDependsOnEntry = -1 - ); +class SwPrintUIOptions : public vcl::PrinterOptionsHelper +{ public: SwPrintUIOptions(); - - void addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ); }; SwPrintUIOptions::SwPrintUIOptions() -: m_aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ) -{ -} - -Any SwPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const PropertyValue* i_pVal, - const Sequence< rtl::OUString >* i_pChoices, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry - ) -{ - Sequence< PropertyValue > aCtrl(6); - sal_Int32 nUsed = 0; - if( i_rTitle.getLength() ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); - aCtrl[nUsed++].Value = makeAny( i_rTitle ); - } - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); - aCtrl[nUsed++].Value = makeAny( i_rType ); - if( i_pVal ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) ); - aCtrl[nUsed++].Value = makeAny( *i_pVal ); - } - if( i_pChoices ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); - aCtrl[nUsed++].Value = makeAny( *i_pChoices ); - } - if( i_pDependsOnName ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) ); - aCtrl[nUsed++].Value = makeAny( *i_pDependsOnName ); - if( i_nDependsOnEntry != -1 ) - { - aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) ); - aCtrl[nUsed++].Value = makeAny( i_nDependsOnEntry ); - } - } - aCtrl.realloc( nUsed ); - return makeAny( aCtrl ); -} - -Any SwPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rProperty, - sal_Bool i_bValue, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry ) { - PropertyValue aVal; - aVal.Name = i_rProperty; - aVal.Value = makeAny( i_bValue ); - return getUIControlOpt( i_rTitle, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, NULL, i_pDependsOnName, i_nDependsOnEntry ); -} - -Any SwPrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rType, - const rtl::OUString& i_rProperty, - const Sequence< rtl::OUString >& i_rChoices, - sal_Int32 i_nValue, - const rtl::OUString* i_pDependsOnName, - sal_Int32 i_nDependsOnEntry ) -{ - PropertyValue aVal; - aVal.Name = i_rProperty; - aVal.Value = makeAny( i_nValue ); - return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); -} + ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); + DBG_ASSERT( aLocalizedStrings.Count() >= 23, "resource incomplete" ); + if( aLocalizedStrings.Count() < 23 ) // bad resource ? + return; -void SwPrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) -{ // create sequence of print UI options - uno::Sequence< beans::PropertyValue > aUIOptions( 19 ); - - DBG_ASSERT( m_aLocalizedStrings.Count() >= 23, "resource incomplete" ); - if( m_aLocalizedStrings.Count() < 23 ) // bad resource ? - return; + m_aUIProperties.realloc( 19 ); // create Section for Contents (results in an extra tab page in dialog) - aUIOptions[0].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 0 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); // create a bool option for graphics - aUIOptions[1].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 1 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), - sal_True ); + m_aUIProperties[1].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), + sal_True ); // create a bool option for tables - aUIOptions[2].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 2 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), - sal_True ); + m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), + sal_True ); // create a bool option for drawings - aUIOptions[3].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), - sal_True ); + m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), + sal_True ); // create a bool option for controls - aUIOptions[4].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 4 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), - sal_True ); + m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), + sal_True ); // create a bool option for background - aUIOptions[5].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), - sal_True ); + m_aUIProperties[5].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), + sal_True ); // create a bool option for black - aUIOptions[6].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 6 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), - sal_False ); + m_aUIProperties[6].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), + sal_False ); // create a bool option for hidden text - aUIOptions[7].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 7 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), - sal_False ); + m_aUIProperties[7].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), + sal_False ); // create a bool option for place holder - aUIOptions[8].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 8 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), - sal_False ); + m_aUIProperties[8].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), + sal_False ); // create a list box for notes content Sequence< rtl::OUString > aChoices( 4 ); - aChoices[0] = m_aLocalizedStrings.GetString( 10 ); - aChoices[1] = m_aLocalizedStrings.GetString( 11 ); - aChoices[2] = m_aLocalizedStrings.GetString( 12 ); - aChoices[3] = m_aLocalizedStrings.GetString( 13 ); - aUIOptions[9].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 9 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), - aChoices, - 0 - ); + aChoices[0] = aLocalizedStrings.GetString( 10 ); + aChoices[1] = aLocalizedStrings.GetString( 11 ); + aChoices[2] = aLocalizedStrings.GetString( 12 ); + aChoices[3] = aLocalizedStrings.GetString( 13 ); + m_aUIProperties[9].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 9 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), + aChoices, + 0, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) + ); // create Section for Page settings (results in an extra tab page in dialog) - aUIOptions[10].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + m_aUIProperties[10].Value = getGroupControlOpt( aLocalizedStrings.GetString( 14 ) ); // create a bool option for left pages - aUIOptions[11].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 15 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), - sal_True ); + m_aUIProperties[11].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), + sal_True ); // create a bool option for right pages - aUIOptions[12].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 16 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), - sal_True ); + m_aUIProperties[12].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), + sal_True ); // create a bool option for reversed order (solve in vcl ?) - aUIOptions[13].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 17 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), - sal_False ); + m_aUIProperties[13].Value = getBoolControlOpt( aLocalizedStrings.GetString( 17 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), + sal_False ); // create a bool option for brochure OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); - aUIOptions[14].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 18 ), - aBrochurePropertyName, - sal_False ); + m_aUIProperties[14].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), + aBrochurePropertyName, + sal_False ); // create a bool option for brochure RTL dependent on brochure - aUIOptions[15].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 19 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), - sal_False, - &aBrochurePropertyName - ); + m_aUIProperties[15].Value = getBoolControlOpt( aLocalizedStrings.GetString( 19 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), + sal_False, + &aBrochurePropertyName + ); // create subgroup for misc options - aUIOptions[16].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 20 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + m_aUIProperties[16].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 20 ) ); // create a bool option for blank pages - aUIOptions[17].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 21 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - sal_True ); + m_aUIProperties[17].Value = getBoolControlOpt( aLocalizedStrings.GetString( 21 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + sal_True ); // create a bool option for paper tray - aUIOptions[18].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 22 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), - sal_False ); + m_aUIProperties[18].Value = getBoolControlOpt( aLocalizedStrings.GetString( 22 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), + sal_False ); - sal_Int32 nLen = io_rProps.getLength(); - io_rProps.realloc( nLen+1 ); - io_rProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); - io_rProps[nLen].Value = uno::makeAny( aUIOptions ); } @@ -2916,7 +2812,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; - m_pPrintUIOptions->addPrintUIOptions( aRenderer ); + m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); return aRenderer; } -- cgit v1.2.3 From fa4ca9fdb46b8436d50ae6a6de91cfc0fc0f6c8c Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 20 Apr 2009 16:57:13 +0000 Subject: CWS-TOOLING: rebase CWS printerpullpages to trunk@270723 (milestone: DEV300:m46) --- sw/inc/fmtcol.hxx | 2 +- sw/source/core/doc/fmtcol.cxx | 24 ++++++++++++++++++++- sw/source/core/text/EnhancedPDFExportHelper.cxx | 9 +++++--- sw/source/core/text/atrstck.cxx | 9 +++++--- sw/source/core/unocore/unocrsrhelper.cxx | 12 +++++++---- sw/source/filter/html/htmlatr.cxx | 2 +- sw/source/filter/rtf/swparrtf.cxx | 2 ++ sw/source/filter/rtf/wrtrtf.cxx | 4 ++-- sw/source/filter/ww8/wrtww8.cxx | 4 +++- sw/source/filter/ww8/ww8par.cxx | 2 +- sw/source/ui/frmdlg/column.cxx | 2 +- sw/source/ui/misc/outline.cxx | 28 ------------------------- 12 files changed, 54 insertions(+), 46 deletions(-) diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index 7dcb6720d593..d06a64cf9bfd 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -116,7 +116,7 @@ public: void SetAttrOutlineLevel( int ); int GetAttrOutlineLevel() const; int GetAssignedOutlineStyleLevel() const; - inline const bool IsAssignedToListLevelOfOutlineStyle() const + inline bool IsAssignedToListLevelOfOutlineStyle() const { return mbAssignedToOutlineStyle; } diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 83ef29ab1d1e..6ee49a81b4b7 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -683,9 +683,31 @@ int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel) { - mbAssignedToOutlineStyle = true; SetAttrOutlineLevel(nAssignedListLevel+1); + + // --> OD 2009-03-18 #i100277# + SwClientIter aIter( *this ); + SwTxtFmtColl* pDerivedTxtFmtColl = + dynamic_cast(aIter.First( TYPE( SwTxtFmtColl ) )); + while ( pDerivedTxtFmtColl != 0 ) + { + if ( !pDerivedTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) + { + if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_DEFAULT ) + { + SwNumRuleItem aItem(aEmptyStr); + pDerivedTxtFmtColl->SetFmtAttr( aItem ); + } + if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_OUTLINELEVEL, FALSE ) == SFX_ITEM_DEFAULT ) + { + pDerivedTxtFmtColl->SetAttrOutlineLevel( 0 ); + } + } + + pDerivedTxtFmtColl = dynamic_cast(aIter.Next()); + } + // <-- } void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle() diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 2dae454614e4..4b9e9ec73cfe 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -676,8 +676,8 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) const SwAttrSet& aSet = static_cast(pFrm)->GetTxtNode()->GetSwAttrSet(); const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust(); if ( SVX_ADJUST_BLOCK == nAdjust || SVX_ADJUST_CENTER == nAdjust || - ( pFrm->IsRightToLeft() && SVX_ADJUST_LEFT == nAdjust || - !pFrm->IsRightToLeft() && SVX_ADJUST_RIGHT == nAdjust ) ) + ( (pFrm->IsRightToLeft() && SVX_ADJUST_LEFT == nAdjust) || + (!pFrm->IsRightToLeft() && SVX_ADJUST_RIGHT == nAdjust) ) ) { eVal = SVX_ADJUST_BLOCK == nAdjust ? vcl::PDFWriter::Justify : @@ -2191,7 +2191,10 @@ void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rP SwRect aHFLinkRect( rLinkRect ); aHFLinkRect.Pos() = pPageFrm->Frm().Pos() + aOffset; - if ( aHFLinkRect != rLinkRect ) + // #i97135# the gcc_x64 optimizer gets aHFLinkRect != rLinkRect wrong + // fool it by comparing the position only (the width and height are the + // same anyway) + if ( aHFLinkRect.Pos() != rLinkRect.Pos() ) { // Link PageNum const sal_Int32 nHFLinkPageNum = CalcOutputPageNum( aHFLinkRect ); diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 383791c8a671..eb4148264931 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -270,8 +270,11 @@ bool lcl_ChgHyperLinkColor( const SwTxtAttr& rAttr, // attribute, instead we take the colors from the view options: // if ( pShell->GetWin() && - ( ((SwTxtINetFmt&)rAttr).IsVisited() && SwViewOption::IsVisitedLinks() || - !((SwTxtINetFmt&)rAttr).IsVisited() && SwViewOption::IsLinks() ) ) + ( + (((SwTxtINetFmt&)rAttr).IsVisited() && SwViewOption::IsVisitedLinks()) || + (!((SwTxtINetFmt&)rAttr).IsVisited() && SwViewOption::IsLinks()) + ) + ) { if ( pColor ) { @@ -749,7 +752,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu pDefaultArray[ nStackPos ]; if( (mpShell && !mpShell->GetWin()) || - pTmpItem && !static_cast(pTmpItem)->GetValue() ) + (pTmpItem && !static_cast(pTmpItem)->GetValue()) ) { rFnt.SetUnderline( ((SvxUnderlineItem&)rItem).GetLineStyle() ); rFnt.SetUnderColor( ((SvxUnderlineItem&)rItem).GetColor() ); diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index d2485a585605..08f61b1341c0 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -630,10 +630,14 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam) } } //jetzt nochmal fuer Fonts - if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() && - ((pBulletFontNames[i].Len() && !aFmt.GetBulletFont()) || - pBulletFontNames[i].Len() && - aFmt.GetBulletFont()->GetName() != pBulletFontNames[i] )) + if( + pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() && + ( + (pBulletFontNames[i].Len() && !aFmt.GetBulletFont()) || + (pBulletFontNames[i].Len() && + aFmt.GetBulletFont()->GetName() != pBulletFontNames[i]) + ) + ) { const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pDoc->GetDocShell() diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 74c3c30c71c2..030409c1e955 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -460,7 +460,7 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, }; sal_uInt16 nRef = 0; - sal_uInt16 aSets[2]; + sal_uInt16 aSets[2] = {0,0}; switch( nCSS1Script ) { case CSS1_OUTMODE_WESTERN: diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index ed32aeb9d361..fd9b8511b906 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -4004,11 +4004,13 @@ SwTxtFmtColl* SwRTFParser::MakeColl(const String& rName, USHORT nPos, } if (!rbCollExist) + { //pColl->SetOutlineLevel( nOutlineLevel ); //#outline level,removed by zhaojianwei if(nOutlineLevel < MAXLEVEL) //->add by zhaojianwei pColl->AssignToListLevelOfOutlineStyle( nOutlineLevel ); else pColl->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,zhaojianwei + } return pColl; } diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx index d0dc00deb276..84eb60cf3847 100644 --- a/sw/source/filter/rtf/wrtrtf.cxx +++ b/sw/source/filter/rtf/wrtrtf.cxx @@ -1683,8 +1683,8 @@ void SwRTFWriter::CheckEndNodeForSection( const SwNode& rNd ) // wer bestimmt den nachsten?? SwNodeIndex aIdx( rNd, 1 ); pSectNd = aIdx.GetNode().GetSectionNode(); - if( !( ( pSectNd || aIdx.GetNode().IsEndNode() && - 0 != ( pSectNd = aIdx.GetNode().StartOfSectionNode()->GetSectionNode() )) + if( !( ( pSectNd || (aIdx.GetNode().IsEndNode() && + 0 != ( pSectNd = aIdx.GetNode().StartOfSectionNode()->GetSectionNode() )) ) /*&& CONTENT_SECTION == pSectNd->GetSection().GetType()*/ )) { // wer bestimmt denn nun den neuen Abschnitt? diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f8e783a02188..0f5372b1f7a0 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2155,7 +2155,7 @@ void SwWW8Writer::OutWW8TableDefinition } } - SwTwips nSz = nTblOffset; + SwTwips nSz = 0; sal_uInt32 n = 0; InsUInt16(nTblOffset); @@ -2168,6 +2168,8 @@ void SwWW8Writer::OutWW8TableDefinition if (bRelBoxSize) nCalc = (nCalc * nPageSize) / nTblSz; + nCalc += nTblOffset; + InsUInt16(static_cast(nCalc)); } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d8769159afc1..e93c3339bc73 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3436,7 +3436,7 @@ void wwSectionManager::InsertSegments() bool bThisAndNextAreCompatible = (aNext != aEnd) ? ((aIter->GetPageWidth() == aNext->GetPageWidth()) && (aIter->GetPageHeight() == aNext->GetPageHeight()) && (aIter->IsLandScape() == aNext->IsLandScape())) : true; - if ((aNext != aEnd && aNext->IsContinous() && bThisAndNextAreCompatible || bProtected)) + if ((aNext != aEnd && aNext->IsContinous() && bThisAndNextAreCompatible) || bProtected) { bIgnoreCols = true; if ((aIter->NoCols() > 1) || bProtected) diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index d96a072d6893..03dd5fa36fdd 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -1244,7 +1244,7 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet) } BOOL bPercent; // im Rahmenformat nur relative Angaben - if ( bFormat || rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff) + if ( bFormat || (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff) ) { // Wert fuer 100% setzen aEd1.SetRefValue(nTotalWish); diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 57d652463a95..9fd448fcb210 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -532,34 +532,6 @@ short SwOutlineTabDialog::Ok() } } - //#outline level,add by zhaojianwei - /* When a paragraph style is assigned to a list level of the outline style, - the outline level attribute and the list style attribute of its existing - child paragraph styles have to be set to 0 respectively "".*/ - nCount = rWrtSh.GetTxtFmtCollCount(); - for( i = 0; i < nCount; ++i ) - { - SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i); - if( !rTxtColl.IsDefault() ) - { - SwTxtFmtColl *pDerFrom = ( SwTxtFmtColl* )rTxtColl.DerivedFrom(); - if( pDerFrom->IsAssignedToListLevelOfOutlineStyle()) - { - if(rTxtColl.GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_DEFAULT ) - { - SwNumRuleItem aItem(aEmptyStr); - rTxtColl.SetFmtAttr( aItem ); - } - if(rTxtColl.GetItemState( RES_PARATR_OUTLINELEVEL, FALSE ) == SFX_ITEM_DEFAULT ) - { - int nOutlineLevel = 0;; - rTxtColl.SetAttrOutlineLevel( nOutlineLevel ); - } - } - } - } - //<-end,zhaojianwei - rWrtSh.SetOutlineNumRule( *pNumRule); // --> OD 2006-12-11 #130443# -- cgit v1.2.3 From 69ed05736da622821985bd5bb493002414d38f59 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 23 Apr 2009 12:34:51 +0000 Subject: #ii101241# new UI print dialog --- starmath/source/unomodel.cxx | 2247 +++++++++++++++++++++--------------------- 1 file changed, 1133 insertions(+), 1114 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 03639668573f..9dac021d8500 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1,1114 +1,1133 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unomodel.cxx,v $ - * $Revision: 1.49 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_starmath.hxx" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef STARMATH_HRC -#include -#endif -#include - -#include - -using namespace ::vos; -using namespace ::rtl; -using namespace ::cppu; -using namespace ::std; -using namespace ::comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::formula; -using namespace ::com::sun::star::view; -using namespace ::com::sun::star::script; - -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - -#define C2U(cChar) rtl::OUString::createFromAscii(cChar) - -class SmPrintUIOptions : public vcl::PrinterOptionsHelper -{ -public: - SmPrintUIOptions(); -}; - -SmPrintUIOptions::SmPrintUIOptions() -{ - ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 10, "resource incomplete" ); - if( aLocalizedStrings.Count() < 10 ) // bad resource ? - return; - - // create sequence of print UI options - m_aUIProperties.realloc( 10 ); - - - // create Section for formula (results in an extra tab page in dialog) - m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); - - // create subgroup for print options - m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ) ); - - // create a bool option for title row - m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), - sal_True ); - // create a bool option for formula text - m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), - sal_True ); - // create a bool option for border - m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), - sal_True ); - - // create subgroup for print format - m_aUIProperties[5].Value = getUIControlOpt( aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); - - // create a radio button group for print format - Sequence< rtl::OUString > aChoices( 3 ); - aChoices[0] = aLocalizedStrings.GetString( 6 ); - aChoices[1] = aLocalizedStrings.GetString( 7 ); - aChoices[2] = aLocalizedStrings.GetString( 8 ); - OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ); - m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), - aPrintFormatProp, - aChoices, 0 - ); - - // create a numeric box for scale dependent on PrintFormat = "Scaling" - m_aUIProperties[ 7 ].Value = getRangeControlOpt( rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ), - 100, // initial value - 10, // min value - 1000, // max value - &aPrintFormatProp, - 2 ); - - // create subgroup for misc options - m_aUIProperties[8].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 9 ) ); - - // create a bool option for ignore spacing - m_aUIProperties[9].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), - sal_True ); -} - - - - -//////////////////////////////////////// -// -// class SmModel -// -#define PROPERTY_NONE 0 -enum SmModelPropertyHandles -{ - HANDLE_FORMULA, - HANDLE_FONT_NAME_VARIABLES, - HANDLE_FONT_NAME_FUNCTIONS, - HANDLE_FONT_NAME_NUMBERS, - HANDLE_FONT_NAME_TEXT, - HANDLE_CUSTOM_FONT_NAME_SERIF, - HANDLE_CUSTOM_FONT_NAME_SANS, - HANDLE_CUSTOM_FONT_NAME_FIXED, - HANDLE_CUSTOM_FONT_FIXED_POSTURE, - HANDLE_CUSTOM_FONT_FIXED_WEIGHT, - HANDLE_CUSTOM_FONT_SANS_POSTURE, - HANDLE_CUSTOM_FONT_SANS_WEIGHT, - HANDLE_CUSTOM_FONT_SERIF_POSTURE, - HANDLE_CUSTOM_FONT_SERIF_WEIGHT, - HANDLE_FONT_VARIABLES_POSTURE, - HANDLE_FONT_VARIABLES_WEIGHT, - HANDLE_FONT_FUNCTIONS_POSTURE, - HANDLE_FONT_FUNCTIONS_WEIGHT, - HANDLE_FONT_NUMBERS_POSTURE, - HANDLE_FONT_NUMBERS_WEIGHT, - HANDLE_FONT_TEXT_POSTURE, - HANDLE_FONT_TEXT_WEIGHT, - HANDLE_BASE_FONT_HEIGHT, - HANDLE_RELATIVE_FONT_HEIGHT_TEXT, - HANDLE_RELATIVE_FONT_HEIGHT_INDICES, - HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS, - HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS, - HANDLE_RELATIVE_FONT_HEIGHT_LIMITS, - HANDLE_IS_TEXT_MODE, - HANDLE_ALIGNMENT, - HANDLE_RELATIVE_SPACING, - HANDLE_RELATIVE_LINE_SPACING, - HANDLE_RELATIVE_ROOT_SPACING, - HANDLE_RELATIVE_INDEX_SUPERSCRIPT, - HANDLE_RELATIVE_INDEX_SUBSCRIPT, - HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT, - HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, - HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, - HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT, - HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE, - HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE, - HANDLE_RELATIVE_BRACKET_EXCESS_SIZE, - HANDLE_RELATIVE_BRACKET_DISTANCE, - HANDLE_IS_SCALE_ALL_BRACKETS, - HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE, - HANDLE_RELATIVE_MATRIX_LINE_SPACING, - HANDLE_RELATIVE_MATRIX_COLUMN_SPACING, - HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT, - HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT, - HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE, - HANDLE_RELATIVE_OPERATOR_SPACING, - HANDLE_LEFT_MARGIN, - HANDLE_RIGHT_MARGIN, - HANDLE_TOP_MARGIN, - HANDLE_BOTTOM_MARGIN, - HANDLE_PRINTER_NAME, - HANDLE_PRINTER_SETUP, - HANDLE_SYMBOLS, - HANDLE_BASIC_LIBRARIES, /* #93295# */ - HANDLE_RUNTIME_UID, - // --> PB 2004-08-25 #i33095# Security Options - HANDLE_LOAD_READONLY, - // <-- - HANDLE_DIALOG_LIBRARIES // #i73329# -}; - -PropertySetInfo * lcl_createModelPropertyInfo () -{ - static PropertyMapEntry aModelPropertyInfoMap[] = - { - { RTL_CONSTASCII_STRINGPARAM( "Alignment" ), HANDLE_ALIGNMENT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "BaseFontHeight" ), HANDLE_BASE_FONT_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "BasicLibraries" ), HANDLE_BASIC_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, - { RTL_CONSTASCII_STRINGPARAM( "BottomMargin" ), HANDLE_BOTTOM_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BOTTOMSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameFixed" ), HANDLE_CUSTOM_FONT_NAME_FIXED , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FIXED }, - { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSans" ), HANDLE_CUSTOM_FONT_NAME_SANS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SANS }, - { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSerif" ), HANDLE_CUSTOM_FONT_NAME_SERIF , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SERIF }, - { RTL_CONSTASCII_STRINGPARAM( "DialogLibraries" ), HANDLE_DIALOG_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, - { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsBold"), HANDLE_CUSTOM_FONT_FIXED_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, - { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsItalic"), HANDLE_CUSTOM_FONT_FIXED_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, - { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsBold"), HANDLE_FONT_FUNCTIONS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, - { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsItalic"), HANDLE_FONT_FUNCTIONS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, - { RTL_CONSTASCII_STRINGPARAM( "FontNameFunctions" ), HANDLE_FONT_NAME_FUNCTIONS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FUNCTION }, - { RTL_CONSTASCII_STRINGPARAM( "FontNameNumbers" ), HANDLE_FONT_NAME_NUMBERS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_NUMBER }, - { RTL_CONSTASCII_STRINGPARAM( "FontNameText" ), HANDLE_FONT_NAME_TEXT , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_TEXT }, - { RTL_CONSTASCII_STRINGPARAM( "FontNameVariables" ), HANDLE_FONT_NAME_VARIABLES , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_VARIABLE }, - { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsBold"), HANDLE_FONT_NUMBERS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, - { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsItalic"), HANDLE_FONT_NUMBERS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, - { RTL_CONSTASCII_STRINGPARAM( "FontSansIsBold"), HANDLE_CUSTOM_FONT_SANS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, - { RTL_CONSTASCII_STRINGPARAM( "FontSansIsItalic"), HANDLE_CUSTOM_FONT_SANS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, - { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsBold"), HANDLE_CUSTOM_FONT_SERIF_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, - { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsItalic"), HANDLE_CUSTOM_FONT_SERIF_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, - { RTL_CONSTASCII_STRINGPARAM( "FontTextIsBold"), HANDLE_FONT_TEXT_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, - { RTL_CONSTASCII_STRINGPARAM( "FontTextIsItalic"), HANDLE_FONT_TEXT_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, - { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsBold"), HANDLE_FONT_VARIABLES_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, - { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsItalic"), HANDLE_FONT_VARIABLES_POSTURE, &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, - { RTL_CONSTASCII_STRINGPARAM( "Formula" ), HANDLE_FORMULA , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "IsScaleAllBrackets" ), HANDLE_IS_SCALE_ALL_BRACKETS , &::getBooleanCppuType(), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "IsTextMode" ), HANDLE_IS_TEXT_MODE , &::getBooleanCppuType(), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ), HANDLE_LEFT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LEFTSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "PrinterName" ), HANDLE_PRINTER_NAME , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "PrinterSetup" ), HANDLE_PRINTER_SETUP , &::getCppuType((const Sequence < sal_Int8 >*)0), PROPERTY_NONE, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketDistance" ), HANDLE_RELATIVE_BRACKET_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketExcessSize" ), HANDLE_RELATIVE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSIZE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightFunctions" ), HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_FUNCTION}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightIndices" ), HANDLE_RELATIVE_FONT_HEIGHT_INDICES , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_INDEX }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightLimits" ), HANDLE_RELATIVE_FONT_HEIGHT_LIMITS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_LIMITS }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightOperators" ), HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_OPERATOR}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightText" ), HANDLE_RELATIVE_FONT_HEIGHT_TEXT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_TEXT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarExcessLength"), HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_FRACTION }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarLineWeight" ), HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_STROKEWIDTH }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionDenominatorDepth"), HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_DENOMINATOR }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionNumeratorHeight" ), HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NUMERATOR }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSubscript" ), HANDLE_RELATIVE_INDEX_SUBSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUBSCRIPT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSuperscript" ), HANDLE_RELATIVE_INDEX_SUPERSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUPERSCRIPT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeLineSpacing" ), HANDLE_RELATIVE_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_VERTICAL }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeLowerLimitDistance" ), HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LOWERLIMIT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixColumnSpacing" ), HANDLE_RELATIVE_MATRIX_COLUMN_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXCOL}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixLineSpacing" ), HANDLE_RELATIVE_MATRIX_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXROW}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorExcessSize" ), HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSIZE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorSpacing" ), HANDLE_RELATIVE_OPERATOR_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSPACE}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeRootSpacing" ), HANDLE_RELATIVE_ROOT_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ROOT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeScaleBracketExcessSize" ), HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NORMALBRACKETSIZE}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeSpacing" ), HANDLE_RELATIVE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_HORIZONTAL }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolMinimumHeight" ), HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolPrimaryHeight" ), HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSIZE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeUpperLimitDistance" ), HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_UPPERLIMIT }, - { RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "RuntimeUID" ), HANDLE_RUNTIME_UID , &::getCppuType(static_cast< const rtl::OUString * >(0)), PropertyAttribute::READONLY, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE }, - // --> PB 2004-08-25 #i33095# Security Options - { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, - // <-- - { NULL, 0, 0, NULL, 0, 0 } - }; - PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap ); - return pInfo; -} -//----------------------------------------------------------------------- -SmModel::SmModel( SfxObjectShell *pObjSh ) -: SfxBaseModel(pObjSh) -, PropertySetHelper ( lcl_createModelPropertyInfo () ) -, m_pPrintUIOptions( NULL ) - -{ -} -//----------------------------------------------------------------------- -SmModel::~SmModel() throw () -{ - delete m_pPrintUIOptions; -} -/*-- 28.03.00 14:18:17--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface ( rType, - // OWeakObject interfaces - dynamic_cast< XInterface* > ( static_cast< XUnoTunnel* > ( this )), - static_cast< XWeak* > ( this ), - // PropertySetHelper interfaces - static_cast< XPropertySet* > ( this ), - static_cast< XMultiPropertySet* > ( this ), - //static_cast< XPropertyState* > ( this ), - // my own interfaces - static_cast< XServiceInfo* > ( this ), - static_cast< XRenderable* > ( this ) ); - if (!aRet.hasValue()) - aRet = SfxBaseModel::queryInterface ( rType ); - return aRet; -} -/*-- 28.03.00 14:18:18--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SAL_CALL SmModel::acquire() throw() -{ - OWeakObject::acquire(); -} -/*-- 28.03.00 14:18:18--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SAL_CALL SmModel::release() throw() -{ - OWeakObject::release(); -} -/*-- 28.03.00 14:18:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( ) throw(uno::RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 4); - uno::Type* pTypes = aTypes.getArray(); - pTypes[nLen++] = ::getCppuType((Reference*)0); - pTypes[nLen++] = ::getCppuType((Reference*)0); - pTypes[nLen++] = ::getCppuType((Reference*)0); - pTypes[nLen++] = ::getCppuType((Reference*)0); - - // XPropertyState not supported?? (respective virtual functions from - // PropertySetHelper not overloaded) - //pTypes[nLen++] = ::getCppuType((Reference*)0); - - return aTypes; -} -/* -----------------------------28.03.00 14:23-------------------------------- - - ---------------------------------------------------------------------------*/ -const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() -{ - static osl::Mutex aCreateMutex; - osl::Guard aGuard( aCreateMutex ); - - static uno::Sequence< sal_Int8 > aSeq; - if(!aSeq.getLength()) - { - aSeq.realloc( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - } - return aSeq; -} /* -----------------------------28.03.00 14:23-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) - throw(uno::RuntimeException) -{ - if( rId.getLength() == 16 - && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - } - - return SfxBaseModel::getSomething( rId ); -} -/*-- 07.01.00 16:32:59--------------------------------------------------- - - -----------------------------------------------------------------------*/ -/*-- 07.01.00 16:33:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Int16 lcl_AnyToINT16(const uno::Any& rAny) -{ - uno::TypeClass eType = rAny.getValueType().getTypeClass(); - - sal_Int16 nRet = 0; - if( eType == uno::TypeClass_DOUBLE ) - nRet = (sal_Int16)*(double*)rAny.getValue(); - else if( eType == uno::TypeClass_FLOAT ) - nRet = (sal_Int16)*(float*)rAny.getValue(); - else - rAny >>= nRet; - return nRet; -} -//----------------------------------------------------------------------------- - -OUString SmModel::getImplementationName(void) throw( uno::RuntimeException ) -{ - return getImplementationName_Static(); -} - - -::rtl::OUString SmModel::getImplementationName_Static() -{ - return rtl::OUString::createFromAscii("com.sun.star.comp.math.FormulaDocument"); -} - -/*-- 20.01.04 11:21:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SmModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) -{ - return ( - rServiceName == C2U("com.sun.star.document.OfficeDocument" ) || - rServiceName == C2U("com.sun.star.formula.FormulaProperties") - ); -} -/*-- 20.01.04 11:21:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Sequence< OUString > SmModel::getSupportedServiceNames(void) throw( uno::RuntimeException ) -{ - return getSupportedServiceNames_Static(); -} - -uno::Sequence< OUString > SmModel::getSupportedServiceNames_Static(void) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - uno::Sequence< OUString > aRet(2); - OUString* pArray = aRet.getArray(); - pArray[0] = C2U("com.sun.star.document.OfficeDocument"); - pArray[1] = C2U("com.sun.star.formula.FormulaProperties"); - return aRet; -} - -void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pValues) - throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); - - if ( NULL == pDocSh ) - throw UnknownPropertyException(); - - SmFormat aFormat = pDocSh->GetFormat(); - - for (; *ppEntries; ppEntries++, pValues++ ) - { - if ((*ppEntries)->mnAttributes & PropertyAttribute::READONLY) - throw PropertyVetoException(); - - switch ( (*ppEntries)->mnHandle ) - { - case HANDLE_FORMULA: - { - OUString aText; - *pValues >>= aText; - pDocSh->SetText(aText); - } - break; - case HANDLE_FONT_NAME_VARIABLES : - case HANDLE_FONT_NAME_FUNCTIONS : - case HANDLE_FONT_NAME_NUMBERS : - case HANDLE_FONT_NAME_TEXT : - case HANDLE_CUSTOM_FONT_NAME_SERIF : - case HANDLE_CUSTOM_FONT_NAME_SANS : - case HANDLE_CUSTOM_FONT_NAME_FIXED : - { - OUString aText; - *pValues >>= aText; - String sFontName = aText; - if(!sFontName.Len()) - throw IllegalArgumentException(); - - if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName) - { - const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId); - - SmFace aSet( sFontName, rOld.GetSize() ); - aSet.SetBorderWidth( rOld.GetBorderWidth() ); - aSet.SetAlign( ALIGN_BASELINE ); - aFormat.SetFont( (*ppEntries)->mnMemberId, aSet ); - } - } - break; - case HANDLE_CUSTOM_FONT_FIXED_POSTURE: - case HANDLE_CUSTOM_FONT_SANS_POSTURE : - case HANDLE_CUSTOM_FONT_SERIF_POSTURE: - case HANDLE_FONT_VARIABLES_POSTURE : - case HANDLE_FONT_FUNCTIONS_POSTURE : - case HANDLE_FONT_NUMBERS_POSTURE : - case HANDLE_FONT_TEXT_POSTURE : - { - if((*pValues).getValueType() != ::getBooleanCppuType()) - throw IllegalArgumentException(); - BOOL bVal = *(sal_Bool*)(*pValues).getValue(); - Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); - aNewFont.SetItalic((bVal) ? ITALIC_NORMAL : ITALIC_NONE); - aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); - } - break; - case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : - case HANDLE_CUSTOM_FONT_SANS_WEIGHT : - case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : - case HANDLE_FONT_VARIABLES_WEIGHT : - case HANDLE_FONT_FUNCTIONS_WEIGHT : - case HANDLE_FONT_NUMBERS_WEIGHT : - case HANDLE_FONT_TEXT_WEIGHT : - { - if((*pValues).getValueType() != ::getBooleanCppuType()) - throw IllegalArgumentException(); - BOOL bVal = *(sal_Bool*)(*pValues).getValue(); - Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); - aNewFont.SetWeight((bVal) ? WEIGHT_BOLD : WEIGHT_NORMAL); - aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); - } - break; - case HANDLE_BASE_FONT_HEIGHT : - { - // Point! - sal_Int16 nVal = lcl_AnyToINT16(*pValues); - if(nVal < 1) - throw IllegalArgumentException(); - Size aSize = aFormat.GetBaseSize(); - nVal *= 20; - nVal = static_cast < sal_Int16 > ( TWIP_TO_MM100(nVal) ); - aSize.Height() = nVal; - aFormat.SetBaseSize(aSize); - - // apply base size to fonts - const Size aTmp( aFormat.GetBaseSize() ); - for (USHORT i = FNT_BEGIN; i <= FNT_END; i++) - aFormat.SetFontSize(i, aTmp); - } - break; - case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : - case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : - case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : - case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : - case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : - { - sal_Int16 nVal = 0; - *pValues >>= nVal; - if(nVal < 1) - throw IllegalArgumentException(); - aFormat.SetRelSize((*ppEntries)->mnMemberId, nVal); - } - break; - - case HANDLE_IS_TEXT_MODE : - { - aFormat.SetTextmode(*(sal_Bool*)(*pValues).getValue()); - } - break; - - case HANDLE_ALIGNMENT : - { - // SmHorAlign uses the same values as HorizontalAlignment - sal_Int16 nVal = 0; - *pValues >>= nVal; - if(nVal < 0 || nVal > 2) - throw IllegalArgumentException(); - aFormat.SetHorAlign((SmHorAlign)nVal); - } - break; - - case HANDLE_RELATIVE_SPACING : - case HANDLE_RELATIVE_LINE_SPACING : - case HANDLE_RELATIVE_ROOT_SPACING : - case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : - case HANDLE_RELATIVE_INDEX_SUBSCRIPT : - case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : - case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: - case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: - case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : - case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_BRACKET_DISTANCE : - case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_MATRIX_LINE_SPACING : - case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : - case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : - case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : - case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : - case HANDLE_RELATIVE_OPERATOR_SPACING : - case HANDLE_LEFT_MARGIN : - case HANDLE_RIGHT_MARGIN : - case HANDLE_TOP_MARGIN : - case HANDLE_BOTTOM_MARGIN : - { - sal_Int16 nVal = 0; - *pValues >>= nVal; - if(nVal < 0) - throw IllegalArgumentException(); - aFormat.SetDistance((*ppEntries)->mnMemberId, nVal); - } - break; - case HANDLE_IS_SCALE_ALL_BRACKETS : - aFormat.SetScaleNormalBrackets(*(sal_Bool*)(*pValues).getValue()); - break; - case HANDLE_PRINTER_NAME: - { - // embedded documents just ignore this property for now - if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) - { - SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); - if (pPrinter) - { - OUString sPrinterName; - if (*pValues >>= sPrinterName ) - { - if ( sPrinterName.getLength() ) - { - SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); - if (pNewPrinter->IsKnown()) - pDocSh->SetPrinter ( pNewPrinter ); - else - delete pNewPrinter; - } - } - else - throw IllegalArgumentException(); - } - } - } - break; - case HANDLE_PRINTER_SETUP: - { - Sequence < sal_Int8 > aSequence; - if ( *pValues >>= aSequence ) - { - sal_uInt32 nSize = aSequence.getLength(); - SvMemoryStream aStream ( aSequence.getArray(), nSize, STREAM_READ ); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - static sal_uInt16 __READONLY_DATA nRange[] = - { - SID_PRINTSIZE, SID_PRINTSIZE, - SID_PRINTZOOM, SID_PRINTZOOM, - SID_PRINTTITLE, SID_PRINTTITLE, - SID_PRINTTEXT, SID_PRINTTEXT, - SID_PRINTFRAME, SID_PRINTFRAME, - SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, - 0 - }; - SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange ); - SmModule *pp = SM_MOD1(); - pp->GetConfig()->ConfigToItemSet(*pItemSet); - SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); - - pDocSh->SetPrinter( pPrinter ); - } - else - throw IllegalArgumentException(); - } - break; - case HANDLE_SYMBOLS: - { - // this is set - Sequence < SymbolDescriptor > aSequence; - if ( *pValues >>= aSequence ) - { - sal_uInt32 nSize = aSequence.getLength(); - SmModule *pp = SM_MOD1(); - SmSymSetManager &rManager = pp->GetSymSetManager(); - SymbolDescriptor *pDescriptor = aSequence.getArray(); - for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++) - { - Font aFont; - aFont.SetName ( pDescriptor->sFontName ); - aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) ); - aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) ); - aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) ); - aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) ); - aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) ); - SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter), - pDescriptor->sSymbolSet ); - aSymbol.SetExportName ( pDescriptor->sExportName ); - aSymbol.SetDocSymbol( TRUE ); - rManager.AddReplaceSymbol ( aSymbol ); - } - } - else - throw IllegalArgumentException(); - } - break; - // --> PB 2004-08-25 #i33095# Security Options - case HANDLE_LOAD_READONLY : - { - if ( (*pValues).getValueType() != ::getBooleanCppuType() ) - throw IllegalArgumentException(); - sal_Bool bReadonly = FALSE; - if ( *pValues >>= bReadonly ) - pDocSh->SetLoadReadonly( bReadonly ); - break; - } - // <-- - } - } - - pDocSh->SetFormat( aFormat ); - - // #i67283# since about all of the above changes are likely to change - // the formula size we have to recalculate the vis-area now - pDocSh->SetVisArea( Rectangle( Point(0, 0), pDocSh->GetSize() ) ); -} - -void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue ) - throw( UnknownPropertyException, WrappedTargetException ) -{ - SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); - - if ( NULL == pDocSh ) - throw UnknownPropertyException(); - - const SmFormat & aFormat = pDocSh->GetFormat(); - - for (; *ppEntries; ppEntries++, pValue++ ) - { - switch ( (*ppEntries)->mnHandle ) - { - case HANDLE_FORMULA: - *pValue <<= OUString(pDocSh->GetText()); - break; - case HANDLE_FONT_NAME_VARIABLES : - case HANDLE_FONT_NAME_FUNCTIONS : - case HANDLE_FONT_NAME_NUMBERS : - case HANDLE_FONT_NAME_TEXT : - case HANDLE_CUSTOM_FONT_NAME_SERIF : - case HANDLE_CUSTOM_FONT_NAME_SANS : - case HANDLE_CUSTOM_FONT_NAME_FIXED : - { - const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - *pValue <<= OUString(rFace.GetName()); - } - break; - case HANDLE_CUSTOM_FONT_FIXED_POSTURE: - case HANDLE_CUSTOM_FONT_SANS_POSTURE : - case HANDLE_CUSTOM_FONT_SERIF_POSTURE: - case HANDLE_FONT_VARIABLES_POSTURE : - case HANDLE_FONT_FUNCTIONS_POSTURE : - case HANDLE_FONT_NUMBERS_POSTURE : - case HANDLE_FONT_TEXT_POSTURE : - { - const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - BOOL bVal = IsItalic( rFace ); - (*pValue).setValue(&bVal, *(*ppEntries)->mpType); - } - break; - case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : - case HANDLE_CUSTOM_FONT_SANS_WEIGHT : - case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : - case HANDLE_FONT_VARIABLES_WEIGHT : - case HANDLE_FONT_FUNCTIONS_WEIGHT : - case HANDLE_FONT_NUMBERS_WEIGHT : - case HANDLE_FONT_TEXT_WEIGHT : - { - const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - BOOL bVal = IsBold( rFace ); // bold? - (*pValue).setValue(&bVal, *(*ppEntries)->mpType); - } - break; - case HANDLE_BASE_FONT_HEIGHT : - { - // Point! - sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height()); - nVal = static_cast < sal_Int16 > (MM100_TO_TWIP(nVal)); - nVal = (nVal + 10) / 20; - *pValue <<= nVal; - } - break; - case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : - case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : - case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : - case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : - case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : - *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId); - break; - - case HANDLE_IS_TEXT_MODE : - { - sal_Bool bVal = aFormat.IsTextmode(); - (*pValue).setValue(&bVal, ::getBooleanCppuType()); - } - break; - - case HANDLE_ALIGNMENT : - // SmHorAlign uses the same values as HorizontalAlignment - *pValue <<= (sal_Int16)aFormat.GetHorAlign(); - break; - - case HANDLE_RELATIVE_SPACING : - case HANDLE_RELATIVE_LINE_SPACING : - case HANDLE_RELATIVE_ROOT_SPACING : - case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : - case HANDLE_RELATIVE_INDEX_SUBSCRIPT : - case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : - case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: - case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: - case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : - case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_BRACKET_DISTANCE : - case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_MATRIX_LINE_SPACING : - case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : - case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : - case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : - case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : - case HANDLE_RELATIVE_OPERATOR_SPACING : - case HANDLE_LEFT_MARGIN : - case HANDLE_RIGHT_MARGIN : - case HANDLE_TOP_MARGIN : - case HANDLE_BOTTOM_MARGIN : - *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId); - break; - case HANDLE_IS_SCALE_ALL_BRACKETS : - { - sal_Bool bVal = aFormat.IsScaleNormalBrackets(); - (*pValue).setValue(&bVal, ::getBooleanCppuType()); - } - break; - case HANDLE_PRINTER_NAME: - { - SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); - *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString(); - } - break; - case HANDLE_PRINTER_SETUP: - { - SfxPrinter *pPrinter = pDocSh->GetPrinter (); - if (pPrinter) - { - SvMemoryStream aStream; - pPrinter->Store( aStream ); - aStream.Seek ( STREAM_SEEK_TO_END ); - sal_uInt32 nSize = aStream.Tell(); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - Sequence < sal_Int8 > aSequence ( nSize ); - aStream.Read ( aSequence.getArray(), nSize ); - *pValue <<= aSequence; - } - } - break; - case HANDLE_SYMBOLS: - { - // this is get - SmModule *pp = SM_MOD1(); - const SmSymSetManager &rManager = pp->GetSymSetManager(); - vector < const SmSym * > aVector; - - USHORT nCount = 0; - for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++) - { - const SmSym * pSymbol = rManager.GetSymbolByPos( i ); - if (pSymbol && !pSymbol->IsPredefined () ) - { - aVector.push_back ( pSymbol ); - nCount++; - } - } - Sequence < SymbolDescriptor > aSequence ( nCount ); - SymbolDescriptor * pDescriptor = aSequence.getArray(); - - vector ::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); - for(; aIter != aEnd; pDescriptor++, aIter++) - { - pDescriptor->sName = (*aIter)->GetName(); - pDescriptor->sExportName = (*aIter)->GetExportName(); - pDescriptor->sSymbolSet = (*aIter)->GetSetName(); - pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter()); - - Font rFont = (*aIter)->GetFace(); - pDescriptor->sFontName = rFont.GetName(); - pDescriptor->nCharSet = sal::static_int_cast< sal_Int16 >(rFont.GetCharSet()); - pDescriptor->nFamily = sal::static_int_cast< sal_Int16 >(rFont.GetFamily()); - pDescriptor->nPitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); - pDescriptor->nWeight = sal::static_int_cast< sal_Int16 >(rFont.GetWeight()); - pDescriptor->nItalic = sal::static_int_cast< sal_Int16 >(rFont.GetItalic()); - } - *pValue <<= aSequence; - } - break; - case HANDLE_BASIC_LIBRARIES: - *pValue <<= pDocSh->GetBasicContainer(); - break; - case HANDLE_DIALOG_LIBRARIES: - *pValue <<= pDocSh->GetDialogContainer(); - break; - case HANDLE_RUNTIME_UID: - *pValue <<= getRuntimeUID(); - break; - // --> PB 2004-08-25 #i33095# Security Options - case HANDLE_LOAD_READONLY : - { - *pValue <<= pDocSh->IsLoadReadonly(); - break; - } - // <-- - } - } -} - -////////////////////////////////////////////////////////////////////// - -sal_Int32 SAL_CALL SmModel::getRendererCount( - const uno::Any& /*rSelection*/, - const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) - throw (IllegalArgumentException, RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SmPrintUIOptions(); - - return 1; -} - - -static Size lcl_GuessPaperSize() -{ - Size aRes; - Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() ); - LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() ); - if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() ) - { - // in Twip - aRes.Width() = lA4Width; - aRes.Height() = lA4Height; - } - else - { - // in Twip - aRes.Width() = lLetterWidth; - aRes.Height() = lLetterHeight; - } - aRes = OutputDevice::LogicToLogic( aRes, MapMode(MAP_TWIP), - MapMode(MAP_100TH_MM) ); - return aRes; -} - -uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( - sal_Int32 nRenderer, - const uno::Any& /*rSelection*/, - const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) - throw (IllegalArgumentException, RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SmPrintUIOptions(); - - if (0 != nRenderer) - throw IllegalArgumentException(); - - SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); - if (!pDocSh) - throw RuntimeException(); - - SmPrinterAccess aPrinterAccess( *pDocSh ); - Printer *pPrinter = aPrinterAccess.GetPrinter(); - //Point aPrtPageOffset( pPrinter->GetPageOffset() ); - Size aPrtPaperSize ( pPrinter->GetPaperSize() ); - - // if paper size is 0 (usually if no 'real' printer is found), - // guess the paper size - if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) - aPrtPaperSize = lcl_GuessPaperSize(); - awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() ); - - uno::Sequence< beans::PropertyValue > aRenderer(1); - PropertyValue &rValue = aRenderer.getArray()[0]; - rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); - rValue.Value <<= aPageSize; - - m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); - - return aRenderer; -} - -void SAL_CALL SmModel::render( - sal_Int32 nRenderer, - const uno::Any& rSelection, - const uno::Sequence< beans::PropertyValue >& rxOptions ) - throw (IllegalArgumentException, RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SmPrintUIOptions(); - - if (0 != nRenderer) - throw IllegalArgumentException(); - - SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); - if (!pDocSh) - throw RuntimeException(); - - // get device to be rendered in - uno::Reference< awt::XDevice > xRenderDevice; - for (sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i) - { - if( rxOptions[i].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) - rxOptions[i].Value >>= xRenderDevice; - } - - if (xRenderDevice.is()) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; - - if (!pOut) - throw RuntimeException(); - - pOut->SetMapMode( MAP_100TH_MM ); - - uno::Reference< frame::XModel > xModel; - rSelection >>= xModel; - if (xModel == pDocSh->GetModel()) - { - //!! when called via API we may not have an active view - //!! thus we go and look for a view that can be used. - const TypeId aTypeId = TYPE( SmViewShell ); - SfxViewShell* pViewSh = SfxViewShell::GetFirst( &aTypeId, sal_False /* search non-visible views as well*/ ); - while (pViewSh && pViewSh->GetObjectShell() != pDocSh) - pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, sal_False /* search non-visible views as well*/ ); - SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh ); - DBG_ASSERT( pView, "SmModel::render : no SmViewShell found" ); - - if (pView) - { - SmPrinterAccess aPrinterAccess( *pDocSh ); - Printer *pPrinter = aPrinterAccess.GetPrinter(); - - Size aPrtPaperSize ( pPrinter->GetPaperSize() ); - Size aOutputSize ( pPrinter->GetOutputSize() ); - Point aPrtPageOffset( pPrinter->GetPageOffset() ); - - // no real printer ?? - if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) - { - aPrtPaperSize = lcl_GuessPaperSize(); - // factors from Windows DIN A4 - aOutputSize = Size( (long)(aPrtPaperSize.Width() * 0.941), - (long)(aPrtPaperSize.Height() * 0.961)); - aPrtPageOffset = Point( (long)(aPrtPaperSize.Width() * 0.0250), - (long)(aPrtPaperSize.Height() * 0.0214)); - } - Point aZeroPoint; - Rectangle OutputRect( aZeroPoint, aOutputSize ); - - - // set minimum top and bottom border - if (aPrtPageOffset.Y() < 2000) - OutputRect.Top() += 2000 - aPrtPageOffset.Y(); - if ((aPrtPaperSize.Height() - (aPrtPageOffset.Y() + OutputRect.Bottom())) < 2000) - OutputRect.Bottom() -= 2000 - (aPrtPaperSize.Height() - - (aPrtPageOffset.Y() + OutputRect.Bottom())); - - // set minimum left and right border - if (aPrtPageOffset.X() < 2500) - OutputRect.Left() += 2500 - aPrtPageOffset.X(); - if ((aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())) < 1500) - OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() - - (aPrtPageOffset.X() + OutputRect.Right())); - - pView->Impl_Print( *pOut, PRINT_SIZE_NORMAL, - Rectangle( OutputRect ), Point() ); - } - } - } -} - -void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xParent) - throw( lang::NoSupportException, uno::RuntimeException ) -{ - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - SfxBaseModel::setParent( xParent ); - uno::Reference< lang::XUnoTunnel > xParentTunnel( xParent, uno::UNO_QUERY ); - if ( xParentTunnel.is() ) - { - SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID ); - SfxObjectShell* pDoc = reinterpret_cast(xParentTunnel->getSomething( - uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) ); - if ( pDoc ) - GetObjectShell()->OnDocumentPrinterChanged( pDoc->GetDocumentPrinter() ); - } -} - +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: unomodel.cxx,v $ + * $Revision: 1.49 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_starmath.hxx" + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef STARMATH_HRC +#include +#endif +#include + +#include + +using namespace ::vos; +using namespace ::rtl; +using namespace ::cppu; +using namespace ::std; +using namespace ::comphelper; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::formula; +using namespace ::com::sun::star::view; +using namespace ::com::sun::star::script; + + +#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) +#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) + +#define A2OU(cChar) rtl::OUString::createFromAscii(cChar) + + +class SmPrintUIOptions : public vcl::PrinterOptionsHelper +{ +public: + SmPrintUIOptions(); +}; + +SmPrintUIOptions::SmPrintUIOptions() +{ + ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); + DBG_ASSERT( aLocalizedStrings.Count() >= 10, "resource incomplete" ); + if( aLocalizedStrings.Count() < 10 ) // bad resource ? + return; + + // create sequence of print UI options + m_aUIProperties.realloc( 10 ); + + + // create Section for formula (results in an extra tab page in dialog) + m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); + + // create subgroup for print options + m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ) ); + + // create a bool option for title row + m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), + sal_True ); + // create a bool option for formula text + m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), + sal_True ); + // create a bool option for border + m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); + + // create subgroup for print format + m_aUIProperties[5].Value = getUIControlOpt( aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a radio button group for print format + Sequence< rtl::OUString > aChoices( 3 ); + aChoices[0] = aLocalizedStrings.GetString( 6 ); + aChoices[1] = aLocalizedStrings.GetString( 7 ); + aChoices[2] = aLocalizedStrings.GetString( 8 ); + OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ); + m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), + aPrintFormatProp, + aChoices, 0 + ); + + // create a numeric box for scale dependent on PrintFormat = "Scaling" + m_aUIProperties[ 7 ].Value = getRangeControlOpt( rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ), + 100, // initial value + 10, // min value + 1000, // max value + &aPrintFormatProp, + 2 ); + + // create subgroup for misc options + m_aUIProperties[8].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 9 ) ); + + // create a bool option for ignore spacing + m_aUIProperties[9].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IgnoreSpaces" ) ), + sal_True ); +} + + + + +//////////////////////////////////////// +// +// class SmModel +// +#define PROPERTY_NONE 0 +enum SmModelPropertyHandles +{ + HANDLE_FORMULA, + HANDLE_FONT_NAME_VARIABLES, + HANDLE_FONT_NAME_FUNCTIONS, + HANDLE_FONT_NAME_NUMBERS, + HANDLE_FONT_NAME_TEXT, + HANDLE_CUSTOM_FONT_NAME_SERIF, + HANDLE_CUSTOM_FONT_NAME_SANS, + HANDLE_CUSTOM_FONT_NAME_FIXED, + HANDLE_CUSTOM_FONT_FIXED_POSTURE, + HANDLE_CUSTOM_FONT_FIXED_WEIGHT, + HANDLE_CUSTOM_FONT_SANS_POSTURE, + HANDLE_CUSTOM_FONT_SANS_WEIGHT, + HANDLE_CUSTOM_FONT_SERIF_POSTURE, + HANDLE_CUSTOM_FONT_SERIF_WEIGHT, + HANDLE_FONT_VARIABLES_POSTURE, + HANDLE_FONT_VARIABLES_WEIGHT, + HANDLE_FONT_FUNCTIONS_POSTURE, + HANDLE_FONT_FUNCTIONS_WEIGHT, + HANDLE_FONT_NUMBERS_POSTURE, + HANDLE_FONT_NUMBERS_WEIGHT, + HANDLE_FONT_TEXT_POSTURE, + HANDLE_FONT_TEXT_WEIGHT, + HANDLE_BASE_FONT_HEIGHT, + HANDLE_RELATIVE_FONT_HEIGHT_TEXT, + HANDLE_RELATIVE_FONT_HEIGHT_INDICES, + HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS, + HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS, + HANDLE_RELATIVE_FONT_HEIGHT_LIMITS, + HANDLE_IS_TEXT_MODE, + HANDLE_ALIGNMENT, + HANDLE_RELATIVE_SPACING, + HANDLE_RELATIVE_LINE_SPACING, + HANDLE_RELATIVE_ROOT_SPACING, + HANDLE_RELATIVE_INDEX_SUPERSCRIPT, + HANDLE_RELATIVE_INDEX_SUBSCRIPT, + HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT, + HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, + HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, + HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT, + HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE, + HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE, + HANDLE_RELATIVE_BRACKET_EXCESS_SIZE, + HANDLE_RELATIVE_BRACKET_DISTANCE, + HANDLE_IS_SCALE_ALL_BRACKETS, + HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE, + HANDLE_RELATIVE_MATRIX_LINE_SPACING, + HANDLE_RELATIVE_MATRIX_COLUMN_SPACING, + HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT, + HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT, + HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE, + HANDLE_RELATIVE_OPERATOR_SPACING, + HANDLE_LEFT_MARGIN, + HANDLE_RIGHT_MARGIN, + HANDLE_TOP_MARGIN, + HANDLE_BOTTOM_MARGIN, + HANDLE_PRINTER_NAME, + HANDLE_PRINTER_SETUP, + HANDLE_SYMBOLS, + HANDLE_BASIC_LIBRARIES, /* #93295# */ + HANDLE_RUNTIME_UID, + // --> PB 2004-08-25 #i33095# Security Options + HANDLE_LOAD_READONLY, + // <-- + HANDLE_DIALOG_LIBRARIES // #i73329# +}; + +PropertySetInfo * lcl_createModelPropertyInfo () +{ + static PropertyMapEntry aModelPropertyInfoMap[] = + { + { RTL_CONSTASCII_STRINGPARAM( "Alignment" ), HANDLE_ALIGNMENT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "BaseFontHeight" ), HANDLE_BASE_FONT_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "BasicLibraries" ), HANDLE_BASIC_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, + { RTL_CONSTASCII_STRINGPARAM( "BottomMargin" ), HANDLE_BOTTOM_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BOTTOMSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameFixed" ), HANDLE_CUSTOM_FONT_NAME_FIXED , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FIXED }, + { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSans" ), HANDLE_CUSTOM_FONT_NAME_SANS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SANS }, + { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSerif" ), HANDLE_CUSTOM_FONT_NAME_SERIF , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SERIF }, + { RTL_CONSTASCII_STRINGPARAM( "DialogLibraries" ), HANDLE_DIALOG_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, + { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsBold"), HANDLE_CUSTOM_FONT_FIXED_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, + { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsItalic"), HANDLE_CUSTOM_FONT_FIXED_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, + { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsBold"), HANDLE_FONT_FUNCTIONS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, + { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsItalic"), HANDLE_FONT_FUNCTIONS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, + { RTL_CONSTASCII_STRINGPARAM( "FontNameFunctions" ), HANDLE_FONT_NAME_FUNCTIONS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FUNCTION }, + { RTL_CONSTASCII_STRINGPARAM( "FontNameNumbers" ), HANDLE_FONT_NAME_NUMBERS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_NUMBER }, + { RTL_CONSTASCII_STRINGPARAM( "FontNameText" ), HANDLE_FONT_NAME_TEXT , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_TEXT }, + { RTL_CONSTASCII_STRINGPARAM( "FontNameVariables" ), HANDLE_FONT_NAME_VARIABLES , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_VARIABLE }, + { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsBold"), HANDLE_FONT_NUMBERS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, + { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsItalic"), HANDLE_FONT_NUMBERS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, + { RTL_CONSTASCII_STRINGPARAM( "FontSansIsBold"), HANDLE_CUSTOM_FONT_SANS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, + { RTL_CONSTASCII_STRINGPARAM( "FontSansIsItalic"), HANDLE_CUSTOM_FONT_SANS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, + { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsBold"), HANDLE_CUSTOM_FONT_SERIF_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, + { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsItalic"), HANDLE_CUSTOM_FONT_SERIF_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, + { RTL_CONSTASCII_STRINGPARAM( "FontTextIsBold"), HANDLE_FONT_TEXT_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, + { RTL_CONSTASCII_STRINGPARAM( "FontTextIsItalic"), HANDLE_FONT_TEXT_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, + { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsBold"), HANDLE_FONT_VARIABLES_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, + { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsItalic"), HANDLE_FONT_VARIABLES_POSTURE, &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, + { RTL_CONSTASCII_STRINGPARAM( "Formula" ), HANDLE_FORMULA , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "IsScaleAllBrackets" ), HANDLE_IS_SCALE_ALL_BRACKETS , &::getBooleanCppuType(), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "IsTextMode" ), HANDLE_IS_TEXT_MODE , &::getBooleanCppuType(), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ), HANDLE_LEFT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LEFTSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "PrinterName" ), HANDLE_PRINTER_NAME , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "PrinterSetup" ), HANDLE_PRINTER_SETUP , &::getCppuType((const Sequence < sal_Int8 >*)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketDistance" ), HANDLE_RELATIVE_BRACKET_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketExcessSize" ), HANDLE_RELATIVE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSIZE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightFunctions" ), HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_FUNCTION}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightIndices" ), HANDLE_RELATIVE_FONT_HEIGHT_INDICES , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_INDEX }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightLimits" ), HANDLE_RELATIVE_FONT_HEIGHT_LIMITS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_LIMITS }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightOperators" ), HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_OPERATOR}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightText" ), HANDLE_RELATIVE_FONT_HEIGHT_TEXT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_TEXT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarExcessLength"), HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_FRACTION }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarLineWeight" ), HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_STROKEWIDTH }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionDenominatorDepth"), HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_DENOMINATOR }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionNumeratorHeight" ), HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NUMERATOR }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSubscript" ), HANDLE_RELATIVE_INDEX_SUBSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUBSCRIPT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSuperscript" ), HANDLE_RELATIVE_INDEX_SUPERSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUPERSCRIPT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeLineSpacing" ), HANDLE_RELATIVE_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_VERTICAL }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeLowerLimitDistance" ), HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LOWERLIMIT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixColumnSpacing" ), HANDLE_RELATIVE_MATRIX_COLUMN_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXCOL}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixLineSpacing" ), HANDLE_RELATIVE_MATRIX_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXROW}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorExcessSize" ), HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSIZE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorSpacing" ), HANDLE_RELATIVE_OPERATOR_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSPACE}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeRootSpacing" ), HANDLE_RELATIVE_ROOT_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ROOT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeScaleBracketExcessSize" ), HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NORMALBRACKETSIZE}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeSpacing" ), HANDLE_RELATIVE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_HORIZONTAL }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolMinimumHeight" ), HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolPrimaryHeight" ), HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSIZE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeUpperLimitDistance" ), HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_UPPERLIMIT }, + { RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "RuntimeUID" ), HANDLE_RUNTIME_UID , &::getCppuType(static_cast< const rtl::OUString * >(0)), PropertyAttribute::READONLY, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE }, + // --> PB 2004-08-25 #i33095# Security Options + { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, + // <-- + { NULL, 0, 0, NULL, 0, 0 } + }; + PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap ); + return pInfo; +} +//----------------------------------------------------------------------- +SmModel::SmModel( SfxObjectShell *pObjSh ) +: SfxBaseModel(pObjSh) +, PropertySetHelper ( lcl_createModelPropertyInfo () ) +, m_pPrintUIOptions( NULL ) + +{ +} +//----------------------------------------------------------------------- +SmModel::~SmModel() throw () +{ + delete m_pPrintUIOptions; +} +/*-- 28.03.00 14:18:17--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) +{ + uno::Any aRet = ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( static_cast< XUnoTunnel* > ( this )), + static_cast< XWeak* > ( this ), + // PropertySetHelper interfaces + static_cast< XPropertySet* > ( this ), + static_cast< XMultiPropertySet* > ( this ), + //static_cast< XPropertyState* > ( this ), + // my own interfaces + static_cast< XServiceInfo* > ( this ), + static_cast< XRenderable* > ( this ) ); + if (!aRet.hasValue()) + aRet = SfxBaseModel::queryInterface ( rType ); + return aRet; +} +/*-- 28.03.00 14:18:18--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SAL_CALL SmModel::acquire() throw() +{ + OWeakObject::acquire(); +} +/*-- 28.03.00 14:18:18--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SAL_CALL SmModel::release() throw() +{ + OWeakObject::release(); +} +/*-- 28.03.00 14:18:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( ) throw(uno::RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); + sal_Int32 nLen = aTypes.getLength(); + aTypes.realloc(nLen + 4); + uno::Type* pTypes = aTypes.getArray(); + pTypes[nLen++] = ::getCppuType((Reference*)0); + pTypes[nLen++] = ::getCppuType((Reference*)0); + pTypes[nLen++] = ::getCppuType((Reference*)0); + pTypes[nLen++] = ::getCppuType((Reference*)0); + + // XPropertyState not supported?? (respective virtual functions from + // PropertySetHelper not overloaded) + //pTypes[nLen++] = ::getCppuType((Reference*)0); + + return aTypes; +} +/* -----------------------------28.03.00 14:23-------------------------------- + + ---------------------------------------------------------------------------*/ +const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() +{ + static osl::Mutex aCreateMutex; + osl::Guard aGuard( aCreateMutex ); + + static uno::Sequence< sal_Int8 > aSeq; + if(!aSeq.getLength()) + { + aSeq.realloc( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + } + return aSeq; +} /* -----------------------------28.03.00 14:23-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) + throw(uno::RuntimeException) +{ + if( rId.getLength() == 16 + && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); + } + + return SfxBaseModel::getSomething( rId ); +} +/*-- 07.01.00 16:32:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +/*-- 07.01.00 16:33:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int16 lcl_AnyToINT16(const uno::Any& rAny) +{ + uno::TypeClass eType = rAny.getValueType().getTypeClass(); + + sal_Int16 nRet = 0; + if( eType == uno::TypeClass_DOUBLE ) + nRet = (sal_Int16)*(double*)rAny.getValue(); + else if( eType == uno::TypeClass_FLOAT ) + nRet = (sal_Int16)*(float*)rAny.getValue(); + else + rAny >>= nRet; + return nRet; +} +//----------------------------------------------------------------------------- + +OUString SmModel::getImplementationName(void) throw( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + + +::rtl::OUString SmModel::getImplementationName_Static() +{ + return rtl::OUString::createFromAscii("com.sun.star.comp.math.FormulaDocument"); +} + +/*-- 20.01.04 11:21:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SmModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) +{ + return ( + rServiceName == A2OU("com.sun.star.document.OfficeDocument" ) || + rServiceName == A2OU("com.sun.star.formula.FormulaProperties") + ); +} +/*-- 20.01.04 11:21:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Sequence< OUString > SmModel::getSupportedServiceNames(void) throw( uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +uno::Sequence< OUString > SmModel::getSupportedServiceNames_Static(void) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + uno::Sequence< OUString > aRet(2); + OUString* pArray = aRet.getArray(); + pArray[0] = A2OU("com.sun.star.document.OfficeDocument"); + pArray[1] = A2OU("com.sun.star.formula.FormulaProperties"); + return aRet; +} + +void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pValues) + throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); + + if ( NULL == pDocSh ) + throw UnknownPropertyException(); + + SmFormat aFormat = pDocSh->GetFormat(); + + for (; *ppEntries; ppEntries++, pValues++ ) + { + if ((*ppEntries)->mnAttributes & PropertyAttribute::READONLY) + throw PropertyVetoException(); + + switch ( (*ppEntries)->mnHandle ) + { + case HANDLE_FORMULA: + { + OUString aText; + *pValues >>= aText; + pDocSh->SetText(aText); + } + break; + case HANDLE_FONT_NAME_VARIABLES : + case HANDLE_FONT_NAME_FUNCTIONS : + case HANDLE_FONT_NAME_NUMBERS : + case HANDLE_FONT_NAME_TEXT : + case HANDLE_CUSTOM_FONT_NAME_SERIF : + case HANDLE_CUSTOM_FONT_NAME_SANS : + case HANDLE_CUSTOM_FONT_NAME_FIXED : + { + OUString aText; + *pValues >>= aText; + String sFontName = aText; + if(!sFontName.Len()) + throw IllegalArgumentException(); + + if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName) + { + const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId); + + SmFace aSet( sFontName, rOld.GetSize() ); + aSet.SetBorderWidth( rOld.GetBorderWidth() ); + aSet.SetAlign( ALIGN_BASELINE ); + aFormat.SetFont( (*ppEntries)->mnMemberId, aSet ); + } + } + break; + case HANDLE_CUSTOM_FONT_FIXED_POSTURE: + case HANDLE_CUSTOM_FONT_SANS_POSTURE : + case HANDLE_CUSTOM_FONT_SERIF_POSTURE: + case HANDLE_FONT_VARIABLES_POSTURE : + case HANDLE_FONT_FUNCTIONS_POSTURE : + case HANDLE_FONT_NUMBERS_POSTURE : + case HANDLE_FONT_TEXT_POSTURE : + { + if((*pValues).getValueType() != ::getBooleanCppuType()) + throw IllegalArgumentException(); + BOOL bVal = *(sal_Bool*)(*pValues).getValue(); + Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); + aNewFont.SetItalic((bVal) ? ITALIC_NORMAL : ITALIC_NONE); + aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); + } + break; + case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : + case HANDLE_CUSTOM_FONT_SANS_WEIGHT : + case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : + case HANDLE_FONT_VARIABLES_WEIGHT : + case HANDLE_FONT_FUNCTIONS_WEIGHT : + case HANDLE_FONT_NUMBERS_WEIGHT : + case HANDLE_FONT_TEXT_WEIGHT : + { + if((*pValues).getValueType() != ::getBooleanCppuType()) + throw IllegalArgumentException(); + BOOL bVal = *(sal_Bool*)(*pValues).getValue(); + Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); + aNewFont.SetWeight((bVal) ? WEIGHT_BOLD : WEIGHT_NORMAL); + aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); + } + break; + case HANDLE_BASE_FONT_HEIGHT : + { + // Point! + sal_Int16 nVal = lcl_AnyToINT16(*pValues); + if(nVal < 1) + throw IllegalArgumentException(); + Size aSize = aFormat.GetBaseSize(); + nVal *= 20; + nVal = static_cast < sal_Int16 > ( TWIP_TO_MM100(nVal) ); + aSize.Height() = nVal; + aFormat.SetBaseSize(aSize); + + // apply base size to fonts + const Size aTmp( aFormat.GetBaseSize() ); + for (USHORT i = FNT_BEGIN; i <= FNT_END; i++) + aFormat.SetFontSize(i, aTmp); + } + break; + case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : + case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : + case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : + case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : + case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : + { + sal_Int16 nVal = 0; + *pValues >>= nVal; + if(nVal < 1) + throw IllegalArgumentException(); + aFormat.SetRelSize((*ppEntries)->mnMemberId, nVal); + } + break; + + case HANDLE_IS_TEXT_MODE : + { + aFormat.SetTextmode(*(sal_Bool*)(*pValues).getValue()); + } + break; + + case HANDLE_ALIGNMENT : + { + // SmHorAlign uses the same values as HorizontalAlignment + sal_Int16 nVal = 0; + *pValues >>= nVal; + if(nVal < 0 || nVal > 2) + throw IllegalArgumentException(); + aFormat.SetHorAlign((SmHorAlign)nVal); + } + break; + + case HANDLE_RELATIVE_SPACING : + case HANDLE_RELATIVE_LINE_SPACING : + case HANDLE_RELATIVE_ROOT_SPACING : + case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : + case HANDLE_RELATIVE_INDEX_SUBSCRIPT : + case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : + case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: + case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: + case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : + case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_BRACKET_DISTANCE : + case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_MATRIX_LINE_SPACING : + case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : + case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : + case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : + case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : + case HANDLE_RELATIVE_OPERATOR_SPACING : + case HANDLE_LEFT_MARGIN : + case HANDLE_RIGHT_MARGIN : + case HANDLE_TOP_MARGIN : + case HANDLE_BOTTOM_MARGIN : + { + sal_Int16 nVal = 0; + *pValues >>= nVal; + if(nVal < 0) + throw IllegalArgumentException(); + aFormat.SetDistance((*ppEntries)->mnMemberId, nVal); + } + break; + case HANDLE_IS_SCALE_ALL_BRACKETS : + aFormat.SetScaleNormalBrackets(*(sal_Bool*)(*pValues).getValue()); + break; + case HANDLE_PRINTER_NAME: + { + // embedded documents just ignore this property for now + if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + { + SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); + if (pPrinter) + { + OUString sPrinterName; + if (*pValues >>= sPrinterName ) + { + if ( sPrinterName.getLength() ) + { + SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); + if (pNewPrinter->IsKnown()) + pDocSh->SetPrinter ( pNewPrinter ); + else + delete pNewPrinter; + } + } + else + throw IllegalArgumentException(); + } + } + } + break; + case HANDLE_PRINTER_SETUP: + { + Sequence < sal_Int8 > aSequence; + if ( *pValues >>= aSequence ) + { + sal_uInt32 nSize = aSequence.getLength(); + SvMemoryStream aStream ( aSequence.getArray(), nSize, STREAM_READ ); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + static sal_uInt16 __READONLY_DATA nRange[] = + { + SID_PRINTSIZE, SID_PRINTSIZE, + SID_PRINTZOOM, SID_PRINTZOOM, + SID_PRINTTITLE, SID_PRINTTITLE, + SID_PRINTTEXT, SID_PRINTTEXT, + SID_PRINTFRAME, SID_PRINTFRAME, + SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, + 0 + }; + SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange ); + SmModule *pp = SM_MOD1(); + pp->GetConfig()->ConfigToItemSet(*pItemSet); + SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); + + pDocSh->SetPrinter( pPrinter ); + } + else + throw IllegalArgumentException(); + } + break; + case HANDLE_SYMBOLS: + { + // this is set + Sequence < SymbolDescriptor > aSequence; + if ( *pValues >>= aSequence ) + { + sal_uInt32 nSize = aSequence.getLength(); + SmModule *pp = SM_MOD1(); + SmSymSetManager &rManager = pp->GetSymSetManager(); + SymbolDescriptor *pDescriptor = aSequence.getArray(); + for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++) + { + Font aFont; + aFont.SetName ( pDescriptor->sFontName ); + aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) ); + aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) ); + aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) ); + aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) ); + aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) ); + SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter), + pDescriptor->sSymbolSet ); + aSymbol.SetExportName ( pDescriptor->sExportName ); + aSymbol.SetDocSymbol( TRUE ); + rManager.AddReplaceSymbol ( aSymbol ); + } + } + else + throw IllegalArgumentException(); + } + break; + // --> PB 2004-08-25 #i33095# Security Options + case HANDLE_LOAD_READONLY : + { + if ( (*pValues).getValueType() != ::getBooleanCppuType() ) + throw IllegalArgumentException(); + sal_Bool bReadonly = FALSE; + if ( *pValues >>= bReadonly ) + pDocSh->SetLoadReadonly( bReadonly ); + break; + } + // <-- + } + } + + pDocSh->SetFormat( aFormat ); + + // #i67283# since about all of the above changes are likely to change + // the formula size we have to recalculate the vis-area now + pDocSh->SetVisArea( Rectangle( Point(0, 0), pDocSh->GetSize() ) ); +} + +void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue ) + throw( UnknownPropertyException, WrappedTargetException ) +{ + SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); + + if ( NULL == pDocSh ) + throw UnknownPropertyException(); + + const SmFormat & aFormat = pDocSh->GetFormat(); + + for (; *ppEntries; ppEntries++, pValue++ ) + { + switch ( (*ppEntries)->mnHandle ) + { + case HANDLE_FORMULA: + *pValue <<= OUString(pDocSh->GetText()); + break; + case HANDLE_FONT_NAME_VARIABLES : + case HANDLE_FONT_NAME_FUNCTIONS : + case HANDLE_FONT_NAME_NUMBERS : + case HANDLE_FONT_NAME_TEXT : + case HANDLE_CUSTOM_FONT_NAME_SERIF : + case HANDLE_CUSTOM_FONT_NAME_SANS : + case HANDLE_CUSTOM_FONT_NAME_FIXED : + { + const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); + *pValue <<= OUString(rFace.GetName()); + } + break; + case HANDLE_CUSTOM_FONT_FIXED_POSTURE: + case HANDLE_CUSTOM_FONT_SANS_POSTURE : + case HANDLE_CUSTOM_FONT_SERIF_POSTURE: + case HANDLE_FONT_VARIABLES_POSTURE : + case HANDLE_FONT_FUNCTIONS_POSTURE : + case HANDLE_FONT_NUMBERS_POSTURE : + case HANDLE_FONT_TEXT_POSTURE : + { + const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); + BOOL bVal = IsItalic( rFace ); + (*pValue).setValue(&bVal, *(*ppEntries)->mpType); + } + break; + case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : + case HANDLE_CUSTOM_FONT_SANS_WEIGHT : + case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : + case HANDLE_FONT_VARIABLES_WEIGHT : + case HANDLE_FONT_FUNCTIONS_WEIGHT : + case HANDLE_FONT_NUMBERS_WEIGHT : + case HANDLE_FONT_TEXT_WEIGHT : + { + const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); + BOOL bVal = IsBold( rFace ); // bold? + (*pValue).setValue(&bVal, *(*ppEntries)->mpType); + } + break; + case HANDLE_BASE_FONT_HEIGHT : + { + // Point! + sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height()); + nVal = static_cast < sal_Int16 > (MM100_TO_TWIP(nVal)); + nVal = (nVal + 10) / 20; + *pValue <<= nVal; + } + break; + case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : + case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : + case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : + case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : + case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : + *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId); + break; + + case HANDLE_IS_TEXT_MODE : + { + sal_Bool bVal = aFormat.IsTextmode(); + (*pValue).setValue(&bVal, ::getBooleanCppuType()); + } + break; + + case HANDLE_ALIGNMENT : + // SmHorAlign uses the same values as HorizontalAlignment + *pValue <<= (sal_Int16)aFormat.GetHorAlign(); + break; + + case HANDLE_RELATIVE_SPACING : + case HANDLE_RELATIVE_LINE_SPACING : + case HANDLE_RELATIVE_ROOT_SPACING : + case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : + case HANDLE_RELATIVE_INDEX_SUBSCRIPT : + case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : + case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: + case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: + case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : + case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_BRACKET_DISTANCE : + case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_MATRIX_LINE_SPACING : + case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : + case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : + case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : + case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : + case HANDLE_RELATIVE_OPERATOR_SPACING : + case HANDLE_LEFT_MARGIN : + case HANDLE_RIGHT_MARGIN : + case HANDLE_TOP_MARGIN : + case HANDLE_BOTTOM_MARGIN : + *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId); + break; + case HANDLE_IS_SCALE_ALL_BRACKETS : + { + sal_Bool bVal = aFormat.IsScaleNormalBrackets(); + (*pValue).setValue(&bVal, ::getBooleanCppuType()); + } + break; + case HANDLE_PRINTER_NAME: + { + SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); + *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString(); + } + break; + case HANDLE_PRINTER_SETUP: + { + SfxPrinter *pPrinter = pDocSh->GetPrinter (); + if (pPrinter) + { + SvMemoryStream aStream; + pPrinter->Store( aStream ); + aStream.Seek ( STREAM_SEEK_TO_END ); + sal_uInt32 nSize = aStream.Tell(); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + Sequence < sal_Int8 > aSequence ( nSize ); + aStream.Read ( aSequence.getArray(), nSize ); + *pValue <<= aSequence; + } + } + break; + case HANDLE_SYMBOLS: + { + // this is get + SmModule *pp = SM_MOD1(); + const SmSymSetManager &rManager = pp->GetSymSetManager(); + vector < const SmSym * > aVector; + + USHORT nCount = 0; + for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++) + { + const SmSym * pSymbol = rManager.GetSymbolByPos( i ); + if (pSymbol && !pSymbol->IsPredefined () ) + { + aVector.push_back ( pSymbol ); + nCount++; + } + } + Sequence < SymbolDescriptor > aSequence ( nCount ); + SymbolDescriptor * pDescriptor = aSequence.getArray(); + + vector ::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); + for(; aIter != aEnd; pDescriptor++, aIter++) + { + pDescriptor->sName = (*aIter)->GetName(); + pDescriptor->sExportName = (*aIter)->GetExportName(); + pDescriptor->sSymbolSet = (*aIter)->GetSetName(); + pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter()); + + Font rFont = (*aIter)->GetFace(); + pDescriptor->sFontName = rFont.GetName(); + pDescriptor->nCharSet = sal::static_int_cast< sal_Int16 >(rFont.GetCharSet()); + pDescriptor->nFamily = sal::static_int_cast< sal_Int16 >(rFont.GetFamily()); + pDescriptor->nPitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); + pDescriptor->nWeight = sal::static_int_cast< sal_Int16 >(rFont.GetWeight()); + pDescriptor->nItalic = sal::static_int_cast< sal_Int16 >(rFont.GetItalic()); + } + *pValue <<= aSequence; + } + break; + case HANDLE_BASIC_LIBRARIES: + *pValue <<= pDocSh->GetBasicContainer(); + break; + case HANDLE_DIALOG_LIBRARIES: + *pValue <<= pDocSh->GetDialogContainer(); + break; + case HANDLE_RUNTIME_UID: + *pValue <<= getRuntimeUID(); + break; + // --> PB 2004-08-25 #i33095# Security Options + case HANDLE_LOAD_READONLY : + { + *pValue <<= pDocSh->IsLoadReadonly(); + break; + } + // <-- + } + } +} + +////////////////////////////////////////////////////////////////////// + +sal_Int32 SAL_CALL SmModel::getRendererCount( + const uno::Any& /*rSelection*/, + const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) + throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new SmPrintUIOptions(); + + return 1; +} + + +static Size lcl_GuessPaperSize() +{ + Size aRes; + Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() ); + LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() ); + if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() ) + { + // in Twip + aRes.Width() = lA4Width; + aRes.Height() = lA4Height; + } + else + { + // in Twip + aRes.Width() = lLetterWidth; + aRes.Height() = lLetterHeight; + } + aRes = OutputDevice::LogicToLogic( aRes, MapMode(MAP_TWIP), + MapMode(MAP_100TH_MM) ); + return aRes; +} + +uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( + sal_Int32 nRenderer, + const uno::Any& /*rSelection*/, + const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) + throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new SmPrintUIOptions(); + + if (0 != nRenderer) + throw IllegalArgumentException(); + + SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); + if (!pDocSh) + throw RuntimeException(); + + SmPrinterAccess aPrinterAccess( *pDocSh ); + Printer *pPrinter = aPrinterAccess.GetPrinter(); + //Point aPrtPageOffset( pPrinter->GetPageOffset() ); + Size aPrtPaperSize ( pPrinter->GetPaperSize() ); + + // if paper size is 0 (usually if no 'real' printer is found), + // guess the paper size + if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) + aPrtPaperSize = lcl_GuessPaperSize(); + awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() ); + + uno::Sequence< beans::PropertyValue > aRenderer(1); + PropertyValue &rValue = aRenderer.getArray()[0]; + rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); + rValue.Value <<= aPageSize; + + m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); + + return aRenderer; +} + +void SAL_CALL SmModel::render( + sal_Int32 nRenderer, + const uno::Any& rSelection, + const uno::Sequence< beans::PropertyValue >& rxOptions ) + throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + if (0 != nRenderer) + throw IllegalArgumentException(); + + SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); + if (!pDocSh) + throw RuntimeException(); + + // get device to be rendered in + uno::Reference< awt::XDevice > xRenderDevice; + for (sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i) + { + if( rxOptions[i].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) + rxOptions[i].Value >>= xRenderDevice; + } + + if (xRenderDevice.is()) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; + + if (!pOut) + throw RuntimeException(); + + pOut->SetMapMode( MAP_100TH_MM ); + + uno::Reference< frame::XModel > xModel; + rSelection >>= xModel; + if (xModel == pDocSh->GetModel()) + { + //!! when called via API we may not have an active view + //!! thus we go and look for a view that can be used. + const TypeId aTypeId = TYPE( SmViewShell ); + SfxViewShell* pViewSh = SfxViewShell::GetFirst( &aTypeId, sal_False /* search non-visible views as well*/ ); + while (pViewSh && pViewSh->GetObjectShell() != pDocSh) + pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, sal_False /* search non-visible views as well*/ ); + SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh ); + DBG_ASSERT( pView, "SmModel::render : no SmViewShell found" ); + + if (pView) + { + SmPrinterAccess aPrinterAccess( *pDocSh ); + Printer *pPrinter = aPrinterAccess.GetPrinter(); + + Size aPrtPaperSize ( pPrinter->GetPaperSize() ); + Size aOutputSize ( pPrinter->GetOutputSize() ); + Point aPrtPageOffset( pPrinter->GetPageOffset() ); + + // no real printer ?? + if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) + { + aPrtPaperSize = lcl_GuessPaperSize(); + // factors from Windows DIN A4 + aOutputSize = Size( (long)(aPrtPaperSize.Width() * 0.941), + (long)(aPrtPaperSize.Height() * 0.961)); + aPrtPageOffset = Point( (long)(aPrtPaperSize.Width() * 0.0250), + (long)(aPrtPaperSize.Height() * 0.0214)); + } + Point aZeroPoint; + Rectangle OutputRect( aZeroPoint, aOutputSize ); + + + // set minimum top and bottom border + if (aPrtPageOffset.Y() < 2000) + OutputRect.Top() += 2000 - aPrtPageOffset.Y(); + if ((aPrtPaperSize.Height() - (aPrtPageOffset.Y() + OutputRect.Bottom())) < 2000) + OutputRect.Bottom() -= 2000 - (aPrtPaperSize.Height() - + (aPrtPageOffset.Y() + OutputRect.Bottom())); + + // set minimum left and right border + if (aPrtPageOffset.X() < 2500) + OutputRect.Left() += 2500 - aPrtPageOffset.X(); + if ((aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())) < 1500) + OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() - + (aPrtPageOffset.X() + OutputRect.Right())); + + // apply print options to be used in Impl_Print + SmModule *pp = SM_MOD1(); + SmConfig *pConfig = pp->GetConfig(); + DBG_ASSERT( pConfig, "SmModel::render: configuration not found" ); + if (pConfig) + { + if (!m_pPrintUIOptions) + m_pPrintUIOptions = new SmPrintUIOptions(); + m_pPrintUIOptions->processProperties( rxOptions ); + + pConfig->SetPrintTitle( m_pPrintUIOptions->getBoolValue( A2OU("TitleRow"), pConfig->IsPrintTitle() ) ); + pConfig->SetPrintFormulaText( m_pPrintUIOptions->getBoolValue( A2OU("FormulaText"), pConfig->IsPrintFormulaText() ) ); + pConfig->SetPrintFrame( m_pPrintUIOptions->getBoolValue( A2OU("Border"), pConfig->IsPrintFrame() ) ); + pConfig->SetPrintSize( static_cast< SmPrintSize >(m_pPrintUIOptions->getIntValue( A2OU("PrintFormat"), pConfig->GetPrintSize() )) ); + pConfig->SetPrintZoomFactor( static_cast< USHORT >(m_pPrintUIOptions->getIntValue( A2OU("PrintScale"), pConfig->GetPrintZoomFactor() )) ); + pConfig->SetIgnoreSpacesRight( m_pPrintUIOptions->getBoolValue( A2OU("IgnoreSpaces"), pConfig->IsIgnoreSpacesRight() ) ); + pConfig->Commit(); + } + + pView->Impl_Print( *pOut, PRINT_SIZE_NORMAL, + Rectangle( OutputRect ), Point() ); + } + } + } +} + +void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xParent) + throw( lang::NoSupportException, uno::RuntimeException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SfxBaseModel::setParent( xParent ); + uno::Reference< lang::XUnoTunnel > xParentTunnel( xParent, uno::UNO_QUERY ); + if ( xParentTunnel.is() ) + { + SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID ); + SfxObjectShell* pDoc = reinterpret_cast(xParentTunnel->getSomething( + uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) ); + if ( pDoc ) + GetObjectShell()->OnDocumentPrinterChanged( pDoc->GetDocumentPrinter() ); + } +} + -- cgit v1.2.3 From ef4d7e6fd3942e85929685af46243ba679ee74ec Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 23 Apr 2009 15:50:43 +0000 Subject: #101241# fix print size --- starmath/source/unomodel.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 9dac021d8500..4c84cc40924a 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -970,7 +970,7 @@ static Size lcl_GuessPaperSize() uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( sal_Int32 nRenderer, const uno::Any& /*rSelection*/, - const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) + const uno::Sequence< beans::PropertyValue >& /*rxOptions*/ ) throw (IllegalArgumentException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); @@ -1108,7 +1108,7 @@ void SAL_CALL SmModel::render( pConfig->Commit(); } - pView->Impl_Print( *pOut, PRINT_SIZE_NORMAL, + pView->Impl_Print( *pOut, pConfig->GetPrintSize(), Rectangle( OutputRect ), Point() ); } } -- cgit v1.2.3 From d643d9b186f51c7e95279cb7c3c85a9d0ef571d5 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 24 Apr 2009 08:49:29 +0000 Subject: #i101241# do not use fonts of undefined size --- starmath/source/view.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 4ff1904ffb0d..bd541a7a185b 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1072,8 +1072,8 @@ void SmViewShell::Impl_Print( // output text on bottom if (pp->GetConfig()->IsPrintFormulaText()) { -// Font aFont(FAMILY_DONTKNOW, Size(0, 600)); - Font aFont; + Font aFont(FAMILY_DONTKNOW, Size(0, 600)); + // Font aFont; aFont.SetAlign(ALIGN_TOP); aFont.SetColor( Color(COL_BLACK) ); -- cgit v1.2.3 From e2b86cdb5cb692e338c9a1be2b47fd6f4687737a Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 24 Apr 2009 11:05:37 +0000 Subject: #i101242# do not reformat all the time --- sw/source/ui/uno/unotxdoc.cxx | 44 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index a4701db19285..dfd925b1edce 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -179,11 +179,16 @@ using ::osl::FileBase; class SwPrintUIOptions : public vcl::PrinterOptionsHelper { + OutputDevice* mpLast; public: SwPrintUIOptions(); + + bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + }; -SwPrintUIOptions::SwPrintUIOptions() +SwPrintUIOptions::SwPrintUIOptions() : + mpLast( NULL ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -295,7 +300,26 @@ SwPrintUIOptions::SwPrintUIOptions() } +bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) +{ + bool bChanged = processProperties( i_rNewProp ); + uno::Reference< awt::XDevice > xRenderDevice; + Any aVal( getValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); + aVal >>= xRenderDevice; + + OutputDevice* pOut = 0; + if (xRenderDevice.is()) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + pOut = pDevice ? pDevice->GetOutputDevice() : 0; + } + bChanged = bChanged || (pOut != mpLast); + if( pOut ) + mpLast = pOut; + + return bChanged; +} SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc) { @@ -2723,7 +2747,7 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS ---------------------------------------------------------------------------*/ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const uno::Any& rSelection, - const uno::Sequence< beans::PropertyValue >& /*rxOptions*/ ) + const uno::Sequence< beans::PropertyValue >& rxOptions ) throw (IllegalArgumentException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); @@ -2732,6 +2756,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if( ! m_pPrintUIOptions ) m_pPrintUIOptions = new SwPrintUIOptions(); + bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection ); @@ -2757,12 +2782,15 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } SwViewOptionAdjust_Impl aAdjust(*pWrtShell); - pWrtShell->SetPDFExportOption( sal_True ); - // --> FME 2005-05-23 #122919# Force field update before PDF export: - pWrtShell->ViewShell::UpdateFlds(TRUE); - // <-- - pWrtShell->CalcLayout(); - pWrtShell->SetPDFExportOption( sal_False ); + if( bFormat ) + { + pWrtShell->SetPDFExportOption( sal_True ); + // --> FME 2005-05-23 #122919# Force field update before PDF export: + pWrtShell->ViewShell::UpdateFlds(TRUE); + // <-- + pWrtShell->CalcLayout(); + pWrtShell->SetPDFExportOption( sal_False ); + } nRet = pDoc->GetPageCount(); return nRet; -- cgit v1.2.3 From 60d5a8c08854fd722858975a4c1636a01904f216 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 24 Apr 2009 13:14:33 +0000 Subject: #i101242# release options helper on last page --- sw/source/ui/uno/unotxdoc.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index dfd925b1edce..0e3907c51e5b 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -3000,6 +3000,9 @@ void SAL_CALL SwXTextDocument::render( lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); m_pHiddenViewFrame = 0; } + + if( bLastPage ) + delete m_pPrintUIOptions, m_pPrintUIOptions = NULL; } } /* -----------------------------03.10.04 ------------------------------------- -- cgit v1.2.3 From 453d21e5a31aa0afaf7ecfb4aea9ac02dfc3449c Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 27 Apr 2009 05:45:59 +0000 Subject: #i101241# new print dialog UI --- starmath/inc/document.hxx | 5 ++- starmath/inc/unomodel.hxx | 25 +++++++++++- starmath/inc/view.hxx | 5 ++- starmath/source/document.cxx | 11 ++--- starmath/source/unomodel.cxx | 95 ++++++++++++++++++-------------------------- starmath/source/view.cxx | 79 +++++++++++++----------------------- 6 files changed, 98 insertions(+), 122 deletions(-) diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index fac4f1b0faa4..597b6691ccbe 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -38,11 +38,10 @@ #include #include #include + #include "format.hxx" #include "parse.hxx" -#ifndef SMMOD_HXX #include "smmod.hxx" -#endif #include @@ -84,6 +83,8 @@ class Printer; class SmDocShell; class EditEngine; +//////////////////////////////////////////////////////////// + class SmPrinterAccess { Printer* pPrinter; diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 2e0ed24dd1fb..40d9b5a09049 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -35,13 +35,31 @@ #include #include #include + #include #include +#include class SmFormat; -class SmPrintUIOptions; -//----------------------------------------------------------------------------- +//////////////////////////////////////////////////////////// + +#define PRTUIOPT_TITLE_ROW "TitleRow" +#define PRTUIOPT_FORMULA_TEXT "FormulaText" +#define PRTUIOPT_BORDER "Border" +#define PRTUIOPT_PRINT_FORMAT "PrintFormat" +#define PRTUIOPT_PRINT_SCALE "PrintScale" +#define PRTUIOPT_NO_RIGHT_SPACE "NoRightSpaces" + +class SmPrintUIOptions : public vcl::PrinterOptionsHelper +{ +public: + SmPrintUIOptions(); +}; + + +//////////////////////////////////////////////////////////// + class SmModel : public SfxBaseModel, public comphelper::PropertySetHelper, public com::sun::star::lang::XServiceInfo, @@ -90,4 +108,7 @@ public: static ::rtl::OUString getImplementationName_Static(); }; +//////////////////////////////////////////////////////////// + #endif + diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 305f5ac873d8..8b1a28fac6bf 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -47,6 +47,7 @@ class DataChangedEvent; class SmClipboardChangeListener; class SmDocShell; class SmViewShell; +class SmPrintUIOptions; /**************************************************************************/ @@ -293,8 +294,8 @@ public: virtual void Execute( SfxRequest& rReq ); virtual void GetState(SfxItemSet &); - void Impl_Print( OutputDevice &rOutDev, const SmPrintSize ePrintSize, - Rectangle aOutRect, Point aZeroPoint ); + void Impl_Print( OutputDevice &rOutDev, const SmPrintUIOptions &rPrintUIOptions, + Rectangle aOutRect, Point aZeroPoint ); }; #endif diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 546af49b2df1..54d15d93d05b 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -116,17 +116,12 @@ using namespace ::com::sun::star::accessibility; static const char __FAR_DATA pStarMathDoc[] = "StarMathDocument"; - -/**************************************************************************/ -/* -** -** CLASS IMPLEMENTATION -** -**/ - #define SmDocShell #include "smslots.hxx" +//////////////////////////////////////////////////////////// + + TYPEINIT1( SmDocShell, SfxObjectShell ); SFX_IMPL_INTERFACE(SmDocShell, SfxObjectShell, SmResId(0)) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 4c84cc40924a..907caad08a32 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -52,15 +52,13 @@ #include #include #include + #include #include #include #include -#ifndef STARMATH_HRC #include -#endif #include - #include using namespace ::vos; @@ -82,12 +80,7 @@ using namespace ::com::sun::star::script; #define A2OU(cChar) rtl::OUString::createFromAscii(cChar) - -class SmPrintUIOptions : public vcl::PrinterOptionsHelper -{ -public: - SmPrintUIOptions(); -}; +//////////////////////////////////////////////////////////// SmPrintUIOptions::SmPrintUIOptions() { @@ -96,48 +89,53 @@ SmPrintUIOptions::SmPrintUIOptions() if( aLocalizedStrings.Count() < 10 ) // bad resource ? return; + SmModule *pp = SM_MOD1(); + SmConfig *pConfig = pp->GetConfig(); + DBG_ASSERT( pConfig, "SmConfig not found" ); + if (!pConfig) + return; + // create sequence of print UI options m_aUIProperties.realloc( 10 ); - // create Section for formula (results in an extra tab page in dialog) m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); // create subgroup for print options m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ) ); - // create a bool option for title row + // create a bool option for title row (matches to SID_PRINTTITLE) m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), - sal_True ); - // create a bool option for formula text + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_TITLE_ROW ) ), + pConfig->IsPrintTitle() ); + // create a bool option for formula text (matches to SID_PRINTTEXT) m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), - sal_True ); - // create a bool option for border + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_FORMULA_TEXT ) ), + pConfig->IsPrintFormulaText() ); + // create a bool option for border (matches to SID_PRINTFRAME) m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), - sal_True ); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_BORDER ) ), + pConfig->IsPrintFrame() ); // create subgroup for print format m_aUIProperties[5].Value = getUIControlOpt( aLocalizedStrings.GetString( 5 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); - // create a radio button group for print format + // create a radio button group for print format (matches to SID_PRINTSIZE) Sequence< rtl::OUString > aChoices( 3 ); aChoices[0] = aLocalizedStrings.GetString( 6 ); aChoices[1] = aLocalizedStrings.GetString( 7 ); aChoices[2] = aLocalizedStrings.GetString( 8 ); - OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ); + OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_PRINT_FORMAT ) ); m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), aPrintFormatProp, - aChoices, 0 + aChoices, static_cast< sal_Int32 >(pConfig->GetPrintSize()) ); - // create a numeric box for scale dependent on PrintFormat = "Scaling" + // create a numeric box for scale dependent on PrintFormat = "Scaling" (matches to SID_PRINTZOOM) m_aUIProperties[ 7 ].Value = getRangeControlOpt( rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ), - 100, // initial value + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_PRINT_SCALE ) ), + pConfig->GetPrintZoomFactor(), // initial value 10, // min value 1000, // max value &aPrintFormatProp, @@ -146,16 +144,14 @@ SmPrintUIOptions::SmPrintUIOptions() // create subgroup for misc options m_aUIProperties[8].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 9 ) ); - // create a bool option for ignore spacing + // create a bool option for ignore spacing (matches to SID_NO_RIGHT_SPACES) m_aUIProperties[9].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IgnoreSpaces" ) ), - sal_True ); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_NO_RIGHT_SPACE ) ), + pConfig->IsIgnoreSpacesRight() ); } - - -//////////////////////////////////////// +//////////////////////////////////////////////////////////// // // class SmModel // @@ -938,9 +934,6 @@ sal_Int32 SAL_CALL SmModel::getRendererCount( throw (IllegalArgumentException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SmPrintUIOptions(); - return 1; } @@ -975,9 +968,6 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SmPrintUIOptions(); - if (0 != nRenderer) throw IllegalArgumentException(); @@ -1001,6 +991,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; + if (!m_pPrintUIOptions) + m_pPrintUIOptions = new SmPrintUIOptions(); m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); return aRenderer; @@ -1089,27 +1081,18 @@ void SAL_CALL SmModel::render( OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())); - // apply print options to be used in Impl_Print - SmModule *pp = SM_MOD1(); - SmConfig *pConfig = pp->GetConfig(); - DBG_ASSERT( pConfig, "SmModel::render: configuration not found" ); - if (pConfig) + if (!m_pPrintUIOptions) + m_pPrintUIOptions = new SmPrintUIOptions(); + m_pPrintUIOptions->processProperties( rxOptions ); + + pView->Impl_Print( *pOut, *m_pPrintUIOptions, Rectangle( OutputRect ), Point() ); + + // release SmPrintUIOptions when everything is done. + // That way, when SmPrintUIOptions is needed again it will read the latest configuration settings in its c-tor. + if (m_pPrintUIOptions->getBoolValue( A2OU("IsLastPage"), sal_False )) { - if (!m_pPrintUIOptions) - m_pPrintUIOptions = new SmPrintUIOptions(); - m_pPrintUIOptions->processProperties( rxOptions ); - - pConfig->SetPrintTitle( m_pPrintUIOptions->getBoolValue( A2OU("TitleRow"), pConfig->IsPrintTitle() ) ); - pConfig->SetPrintFormulaText( m_pPrintUIOptions->getBoolValue( A2OU("FormulaText"), pConfig->IsPrintFormulaText() ) ); - pConfig->SetPrintFrame( m_pPrintUIOptions->getBoolValue( A2OU("Border"), pConfig->IsPrintFrame() ) ); - pConfig->SetPrintSize( static_cast< SmPrintSize >(m_pPrintUIOptions->getIntValue( A2OU("PrintFormat"), pConfig->GetPrintSize() )) ); - pConfig->SetPrintZoomFactor( static_cast< USHORT >(m_pPrintUIOptions->getIntValue( A2OU("PrintScale"), pConfig->GetPrintZoomFactor() )) ); - pConfig->SetIgnoreSpacesRight( m_pPrintUIOptions->getBoolValue( A2OU("IgnoreSpaces"), pConfig->IsIgnoreSpacesRight() ) ); - pConfig->Commit(); + delete m_pPrintUIOptions; m_pPrintUIOptions = 0; } - - pView->Impl_Print( *pOut, pConfig->GetPrintSize(), - Rectangle( OutputRect ), Point() ); } } } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index bd541a7a185b..d23582d7ef65 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -58,24 +59,25 @@ #include #include #include +#include +#include +#include #include #include #include -#include #include #include -#include -#include + +#include "unomodel.hxx" +#include "mathml.hxx" #include "view.hxx" #include "document.hxx" #include "config.hxx" #include "toolbox.hxx" #include "dialog.hxx" -#ifndef _STARMATH_HRC #include "starmath.hrc" -#endif #define MINWIDTH 200 @@ -89,9 +91,7 @@ #define SmViewShell #include "smslots.hxx" -#include //CHINA001 -#include //CHINA001 - +#define A2OU(cChar) rtl::OUString::createFromAscii(cChar) using namespace com::sun::star::accessibility; using namespace com::sun::star; @@ -1012,18 +1012,24 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const } void SmViewShell::Impl_Print( - OutputDevice &rOutDev, const SmPrintSize ePrintSize, + OutputDevice &rOutDev, + const SmPrintUIOptions &rPrintUIOptions, Rectangle aOutRect, Point aZeroPoint ) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Impl_Print" ); - SmModule *pp = SM_MOD1(); + const bool bIsPrintTitle = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_TITLE_ROW ), sal_True ); + const bool bIsPrintFrame = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_BORDER ), sal_True ); + const bool bIsPrintFormulaText = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_FORMULA_TEXT ), sal_True ); + SmPrintSize ePrintSize( static_cast< SmPrintSize >( rPrintUIOptions.getIntValue( A2OU( PRTUIOPT_PRINT_FORMAT ), PRINT_SIZE_NORMAL ) )); + const USHORT nZoomFactor = static_cast< USHORT >(rPrintUIOptions.getIntValue( A2OU( PRTUIOPT_PRINT_SCALE ), 100 )); + const bool bNoRightSpaces = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_NO_RIGHT_SPACE ), sal_True ); rOutDev.Push(); rOutDev.SetLineColor( Color(COL_BLACK) ); // output text on top - if (pp->GetConfig()->IsPrintTitle()) + if (bIsPrintTitle) { Size aSize600 (0, 600); Size aSize650 (0, 650); @@ -1043,7 +1049,7 @@ void SmViewShell::Impl_Print( Size aDescSize (GetTextSize(rOutDev, GetDoc()->GetComment(), aOutRect.GetWidth() - 200)); - if (pp->GetConfig()->IsPrintFrame()) + if (bIsPrintFrame) rOutDev.DrawRect(Rectangle(aOutRect.TopLeft(), Size(aOutRect.GetWidth(), 100 + aTitleSize.Height() + 200 + aDescSize.Height() + 100))); aOutRect.Top() += 200; @@ -1070,7 +1076,7 @@ void SmViewShell::Impl_Print( } // output text on bottom - if (pp->GetConfig()->IsPrintFormulaText()) + if (bIsPrintFormulaText) { Font aFont(FAMILY_DONTKNOW, Size(0, 600)); // Font aFont; @@ -1085,7 +1091,7 @@ void SmViewShell::Impl_Print( aOutRect.Bottom() -= aSize.Height() + 600; - if (pp->GetConfig()->IsPrintFrame()) + if (bIsPrintFrame) rOutDev.DrawRect(Rectangle(aOutRect.BottomLeft(), Size(aOutRect.GetWidth(), 200 + aSize.Height() + 200))); @@ -1096,7 +1102,7 @@ void SmViewShell::Impl_Print( aOutRect.Bottom() -= 200; } - if (pp->GetConfig()->IsPrintFrame()) + if (bIsPrintFrame) rOutDev.DrawRect(aOutRect); aOutRect.Top() += 100; @@ -1107,6 +1113,9 @@ void SmViewShell::Impl_Print( Size aSize (GetDoc()->GetSize()); MapMode OutputMapMode; + // PDF export should always use PRINT_SIZE_NORMAL ... + if (!rPrintUIOptions.getBoolValue( A2OU( "IsPrinter" ), sal_False ) ) + ePrintSize = PRINT_SIZE_NORMAL; switch (ePrintSize) { case PRINT_SIZE_NORMAL: @@ -1131,7 +1140,7 @@ void SmViewShell::Impl_Print( case PRINT_SIZE_ZOOMED: { - Fraction aFraction (pp->GetConfig()->GetPrintZoomFactor(), 100); + Fraction aFraction( nZoomFactor, 100 ); OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction); break; @@ -1157,44 +1166,10 @@ void SmViewShell::Impl_Print( rOutDev.Pop(); } -USHORT SmViewShell::Print(SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog) +USHORT SmViewShell::Print(SfxProgress & /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog * /*pPrintDialog*/) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Print" ); - - SmPrinterAccess aPrinterAccess( *GetDoc() ); - Printer *pPrinter = aPrinterAccess.GetPrinter(); - //OutputDevice *pOutDev = pPrinter; - - SfxViewShell::Print (rProgress, bIsAPI, pPrintDialog); - - pPrinter->StartPage(); - - Point aZeroPoint; - Rectangle OutputRect( aZeroPoint, pPrinter->GetOutputSize() ); - - Point aPrtPageOffset( pPrinter->GetPageOffset() ); - Size aPrtPaperSize ( pPrinter->GetPaperSize() ); - - // set minimum top and bottom border - if (aPrtPageOffset.Y() < 2000) - OutputRect.Top() += 2000 - aPrtPageOffset.Y(); - if ((aPrtPaperSize.Height() - (aPrtPageOffset.Y() + OutputRect.Bottom())) < 2000) - OutputRect.Bottom() -= 2000 - (aPrtPaperSize.Height() - - (aPrtPageOffset.Y() + OutputRect.Bottom())); - - // set minimum left and right border - if (aPrtPageOffset.X() < 2500) - OutputRect.Left() += 2500 - aPrtPageOffset.X(); - if ((aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())) < 1500) - OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() - - (aPrtPageOffset.X() + OutputRect.Right())); - - SmModule *pp = SM_MOD1(); - Impl_Print( *pPrinter, pp->GetConfig()->GetPrintSize(), - OutputRect, aZeroPoint ); - - pPrinter->EndPage(); - + DBG_ASSERT( 0, "SmViewShell::Print: no longer usewd with new UI print dialog. Should be removed!!" ); return 0; } -- cgit v1.2.3 From 748ce9a34fe6ab7a6a12c389895c197444d95aab Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 27 Apr 2009 06:28:27 +0000 Subject: #i101241# new print dialog UI --- starmath/inc/unomodel.hxx | 1 - starmath/source/unomodel.cxx | 19 +++++++++++-------- starmath/source/view.cxx | 5 ++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 40d9b5a09049..c558e6973368 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -49,7 +49,6 @@ class SmFormat; #define PRTUIOPT_BORDER "Border" #define PRTUIOPT_PRINT_FORMAT "PrintFormat" #define PRTUIOPT_PRINT_SCALE "PrintScale" -#define PRTUIOPT_NO_RIGHT_SPACE "NoRightSpaces" class SmPrintUIOptions : public vcl::PrinterOptionsHelper { diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 907caad08a32..345ae5b5da62 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -96,7 +96,8 @@ SmPrintUIOptions::SmPrintUIOptions() return; // create sequence of print UI options - m_aUIProperties.realloc( 10 ); + // (Actually IsIgnoreSpacesRight is a parser option. Without it we need only 8 properties here.) + m_aUIProperties.realloc( 8 ); // create Section for formula (results in an extra tab page in dialog) m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); @@ -141,13 +142,15 @@ SmPrintUIOptions::SmPrintUIOptions() &aPrintFormatProp, 2 ); - // create subgroup for misc options - m_aUIProperties[8].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 9 ) ); - - // create a bool option for ignore spacing (matches to SID_NO_RIGHT_SPACES) - m_aUIProperties[9].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_NO_RIGHT_SPACE ) ), - pConfig->IsIgnoreSpacesRight() ); +// IsIgnoreSpacesRight is a parser option! Thus we don't add it to the printer UI. +// +// // create subgroup for misc options +// m_aUIProperties[8].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 9 ) ); +// +// // create a bool option for ignore spacing (matches to SID_NO_RIGHT_SPACES) +// m_aUIProperties[9].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), +// rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_NO_RIGHT_SPACE ) ), +// pConfig->IsIgnoreSpacesRight() ); } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index d23582d7ef65..99008589aeef 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1023,7 +1023,8 @@ void SmViewShell::Impl_Print( const bool bIsPrintFormulaText = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_FORMULA_TEXT ), sal_True ); SmPrintSize ePrintSize( static_cast< SmPrintSize >( rPrintUIOptions.getIntValue( A2OU( PRTUIOPT_PRINT_FORMAT ), PRINT_SIZE_NORMAL ) )); const USHORT nZoomFactor = static_cast< USHORT >(rPrintUIOptions.getIntValue( A2OU( PRTUIOPT_PRINT_SCALE ), 100 )); - const bool bNoRightSpaces = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_NO_RIGHT_SPACE ), sal_True ); +// IsIgnoreSpacesRight is a parser option! Thus it does not get evaluated here anymore (too late). +// const bool bNoRightSpaces = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_NO_RIGHT_SPACE ), sal_True ); rOutDev.Push(); rOutDev.SetLineColor( Color(COL_BLACK) ); @@ -1079,8 +1080,6 @@ void SmViewShell::Impl_Print( if (bIsPrintFormulaText) { Font aFont(FAMILY_DONTKNOW, Size(0, 600)); - // Font aFont; - aFont.SetAlign(ALIGN_TOP); aFont.SetColor( Color(COL_BLACK) ); -- cgit v1.2.3 From 27369a2067702e9b4c19cd6249b95b1b617607cd Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 27 Apr 2009 16:11:13 +0000 Subject: #i92516# HelpTexts for new print UI --- starmath/source/smres.src | 7 +++++++ starmath/source/unomodel.cxx | 30 +++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/starmath/source/smres.src b/starmath/source/smres.src index e45cf2cc3711..c77cf57e7431 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -3589,14 +3589,21 @@ StringArray RID_PRINTUIOPTIONS <"Formula"; >; < "Print options"; >; < "~Title row"; >; + < "Specifies whether you want the name of the document to be included in the printout"; >; < "~Formula text"; >; + < "Specifies whether to include the contents of the Commands window at the bottom of the printout."; >; < "B~order"; >; + < "Applies a thin border to the formula area in the printout."; >; < "Print format"; >; < "O~riginal size"; >; + < "Prints the formula without adjusting the current font size."; >; < "Fit to ~page"; >; + < "Adjusts the formula to the page format used in the printout."; >; < "~Scaling"; >; + < "Reduces or enlarges the size of the printed formula by a specified enlargement factor."; >; < "Miscellaneous options"; >; < "Ig~nore ~~ and ` at the end of the line"; >; + < "Specfies that these space wildcards will be removed if they are at the end of a line."; >; }; }; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 345ae5b5da62..b00deea40b38 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -85,8 +85,8 @@ using namespace ::com::sun::star::script; SmPrintUIOptions::SmPrintUIOptions() { ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 10, "resource incomplete" ); - if( aLocalizedStrings.Count() < 10 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 15, "resource incomplete" ); + if( aLocalizedStrings.Count() < 15 ) // bad resource ? return; SmModule *pp = SM_MOD1(); @@ -100,41 +100,49 @@ SmPrintUIOptions::SmPrintUIOptions() m_aUIProperties.realloc( 8 ); // create Section for formula (results in an extra tab page in dialog) - m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); + m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); // create subgroup for print options - m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ) ); + m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); // create a bool option for title row (matches to SID_PRINTTITLE) m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + aLocalizedStrings.GetString( 3 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_TITLE_ROW ) ), pConfig->IsPrintTitle() ); // create a bool option for formula text (matches to SID_PRINTTEXT) - m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + aLocalizedStrings.GetString( 5 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_FORMULA_TEXT ) ), pConfig->IsPrintFormulaText() ); // create a bool option for border (matches to SID_PRINTFRAME) - m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), + aLocalizedStrings.GetString( 7 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_BORDER ) ), pConfig->IsPrintFrame() ); // create subgroup for print format - m_aUIProperties[5].Value = getUIControlOpt( aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + m_aUIProperties[5].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 8 ), rtl::OUString() ); // create a radio button group for print format (matches to SID_PRINTSIZE) Sequence< rtl::OUString > aChoices( 3 ); - aChoices[0] = aLocalizedStrings.GetString( 6 ); - aChoices[1] = aLocalizedStrings.GetString( 7 ); - aChoices[2] = aLocalizedStrings.GetString( 8 ); + aChoices[0] = aLocalizedStrings.GetString( 9 ); + aChoices[1] = aLocalizedStrings.GetString( 11 ); + aChoices[2] = aLocalizedStrings.GetString( 13 ); + Sequence< rtl::OUString > aHelpTexts( 3 ); + aHelpTexts[0] = aLocalizedStrings.GetString( 10 ); + aHelpTexts[1] = aLocalizedStrings.GetString( 12 ); + aHelpTexts[2] = aLocalizedStrings.GetString( 14 ); OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_PRINT_FORMAT ) ); m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), + aHelpTexts, aPrintFormatProp, aChoices, static_cast< sal_Int32 >(pConfig->GetPrintSize()) ); // create a numeric box for scale dependent on PrintFormat = "Scaling" (matches to SID_PRINTZOOM) m_aUIProperties[ 7 ].Value = getRangeControlOpt( rtl::OUString(), + aLocalizedStrings.GetString( 14 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_PRINT_SCALE ) ), pConfig->GetPrintZoomFactor(), // initial value 10, // min value -- cgit v1.2.3 From 0c03078f953a79ace1e9feae55cd827785ae0591 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 27 Apr 2009 16:16:26 +0000 Subject: #i92516# HelpTexts for new print UI --- sw/source/ui/config/optdlg.src | 16 ++++++++++ sw/source/ui/uno/unotxdoc.cxx | 67 +++++++++++++++++++++++++++--------------- 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 343d4daa389a..067c4b445676 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -942,27 +942,43 @@ StringArray STR_PRINTOPTUI { < "Contents"; >; < "~Graphics"; >; + < "Specifies whether the graphics of your text document are printed"; >; < "~Tables"; >; + < "Specifies whether the tables of the text document are printed"; >; < "Dra~wings"; >; + < "Specifies whether graphics created with %PRODUCTNAME drawing functions are printed."; >; < "Control~s"; >; + < "Specifies whether the form control fields of the text document are printed"; >; < "Ba~ckground"; >; + < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; < "Print blac~k"; >; + < "Specifies whether to always print text in black."; >; < "Hidden te~xt"; >; + < "Enable this option to print text that is marked as hidden."; >; < "Text ~placeholder"; >; + < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; < "~Notes"; >; + < "Specify where to print notes (if any)."; >; < "None"; >; < "Notes only"; >; < " at end of document"; >; < " at end of page"; >; < "Page settings"; >; < "~Left pages"; >; + < "Specifies whether to print all left pages of the document."; >; < "~Right pages"; >; + < "Specifies whether to print all right pages of the document."; >; < "Re~versed"; >; + < "Specifies whether to reverse the printing order."; >; < "Broch~ure"; >; + < "Select the Brochure option to print the document in brochure format."; >; < "Right to Left"; >; + < "Check to print the pages of the brochure in the correct order for a right-to-left script."; >; < "Other"; >; < "Print ~automatically inserted blank pages"; >; + < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; < "~Paper tray from printer settings"; >; + < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; }; }; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 0e3907c51e5b..d938b5df55ff 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -192,62 +192,74 @@ SwPrintUIOptions::SwPrintUIOptions() : { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 23, "resource incomplete" ); - if( aLocalizedStrings.Count() < 23 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 39, "resource incomplete" ); + if( aLocalizedStrings.Count() < 39 ) // bad resource ? return; // create sequence of print UI options m_aUIProperties.realloc( 19 ); // create Section for Contents (results in an extra tab page in dialog) - m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ) ); + m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); // create a bool option for graphics m_aUIProperties[1].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), + aLocalizedStrings.GetString( 2 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), sal_True ); // create a bool option for tables - m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + aLocalizedStrings.GetString( 4 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), sal_True ); // create a bool option for drawings - m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), + aLocalizedStrings.GetString( 6 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), sal_True ); // create a bool option for controls - m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), + aLocalizedStrings.GetString( 8 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), sal_True ); // create a bool option for background - m_aUIProperties[5].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), + m_aUIProperties[5].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), + aLocalizedStrings.GetString( 10 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), sal_True ); // create a bool option for black - m_aUIProperties[6].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), + m_aUIProperties[6].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), + aLocalizedStrings.GetString( 12 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), sal_False ); // create a bool option for hidden text - m_aUIProperties[7].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), + m_aUIProperties[7].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), + aLocalizedStrings.GetString( 14 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), sal_False ); // create a bool option for place holder - m_aUIProperties[8].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), + m_aUIProperties[8].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), + aLocalizedStrings.GetString( 16 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), sal_False ); // create a list box for notes content Sequence< rtl::OUString > aChoices( 4 ); - aChoices[0] = aLocalizedStrings.GetString( 10 ); - aChoices[1] = aLocalizedStrings.GetString( 11 ); - aChoices[2] = aLocalizedStrings.GetString( 12 ); - aChoices[3] = aLocalizedStrings.GetString( 13 ); - m_aUIProperties[9].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 9 ), + aChoices[0] = aLocalizedStrings.GetString( 19 ); + aChoices[1] = aLocalizedStrings.GetString( 20 ); + aChoices[2] = aLocalizedStrings.GetString( 21 ); + aChoices[3] = aLocalizedStrings.GetString( 22 ); + Sequence< rtl::OUString > aHelpText( 2 ); + aHelpText[0] = aLocalizedStrings.GetString( 18 ); + aHelpText[1] = aLocalizedStrings.GetString( 18 ); + m_aUIProperties[9].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), + aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), aChoices, 0, @@ -255,46 +267,53 @@ SwPrintUIOptions::SwPrintUIOptions() : ); // create Section for Page settings (results in an extra tab page in dialog) - m_aUIProperties[10].Value = getGroupControlOpt( aLocalizedStrings.GetString( 14 ) ); + m_aUIProperties[10].Value = getGroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); // create a bool option for left pages - m_aUIProperties[11].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), + m_aUIProperties[11].Value = getBoolControlOpt( aLocalizedStrings.GetString( 24 ), + aLocalizedStrings.GetString( 25 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), sal_True ); // create a bool option for right pages - m_aUIProperties[12].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), + m_aUIProperties[12].Value = getBoolControlOpt( aLocalizedStrings.GetString( 26 ), + aLocalizedStrings.GetString( 27 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), sal_True ); // create a bool option for reversed order (solve in vcl ?) - m_aUIProperties[13].Value = getBoolControlOpt( aLocalizedStrings.GetString( 17 ), + m_aUIProperties[13].Value = getBoolControlOpt( aLocalizedStrings.GetString( 28 ), + aLocalizedStrings.GetString( 29 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), sal_False ); // create a bool option for brochure OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); - m_aUIProperties[14].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), + m_aUIProperties[14].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), + aLocalizedStrings.GetString( 31 ), aBrochurePropertyName, sal_False ); // create a bool option for brochure RTL dependent on brochure - m_aUIProperties[15].Value = getBoolControlOpt( aLocalizedStrings.GetString( 19 ), + m_aUIProperties[15].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), + aLocalizedStrings.GetString( 33 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), sal_False, &aBrochurePropertyName ); // create subgroup for misc options - m_aUIProperties[16].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 20 ) ); + m_aUIProperties[16].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 34 ), rtl::OUString() ); // create a bool option for blank pages - m_aUIProperties[17].Value = getBoolControlOpt( aLocalizedStrings.GetString( 21 ), + m_aUIProperties[17].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), + aLocalizedStrings.GetString( 36 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), sal_True ); // create a bool option for paper tray - m_aUIProperties[18].Value = getBoolControlOpt( aLocalizedStrings.GetString( 22 ), + m_aUIProperties[18].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), + aLocalizedStrings.GetString( 38 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), sal_False ); -- cgit v1.2.3 From 44014e3a043f1b8fc3a5ed6a5e29a8fb0a6f3969 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 13 May 2009 11:30:08 +0000 Subject: #i101242# new print UI dialog in sw --- sw/source/ui/uno/unotxdoc.cxx | 118 +++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 43 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index d938b5df55ff..dbb549e1e037 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -38,16 +38,12 @@ #include #include #include -#ifndef _TOOLKIT_UNOHLP_HXX #include -#endif #include #include #include #include -#ifndef _SRCVIEW_HXX #include -#endif #include #include #include @@ -81,14 +77,13 @@ #include #include #include +#include #include #include #include #include -#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_ #include -#endif #include #include #include @@ -96,13 +91,9 @@ #include #include #include -#ifndef _MODOPT_HXX // #include -#endif #include -#ifndef _UTLUI_HRC #include -#endif #include #include #include @@ -181,13 +172,13 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper { OutputDevice* mpLast; public: - SwPrintUIOptions(); + SwPrintUIOptions( BOOL bWeb ); bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); }; -SwPrintUIOptions::SwPrintUIOptions() : +SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : mpLast( NULL ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -197,57 +188,66 @@ SwPrintUIOptions::SwPrintUIOptions() : return; // create sequence of print UI options - m_aUIProperties.realloc( 19 ); + // (5 options are not available for Writer-Web) + const int nNumProps = bWeb? 14 : 19; + m_aUIProperties.realloc( nNumProps ); + int nIdx = 0; // create Section for Contents (results in an extra tab page in dialog) - m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); // create a bool option for graphics - m_aUIProperties[1].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), aLocalizedStrings.GetString( 2 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), sal_True ); // create a bool option for tables - m_aUIProperties[2].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), aLocalizedStrings.GetString( 4 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), sal_True ); - // create a bool option for drawings - m_aUIProperties[3].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), + if (!bWeb) + { + // create a bool option for drawings + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), aLocalizedStrings.GetString( 6 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), sal_True ); + } // create a bool option for controls - m_aUIProperties[4].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), aLocalizedStrings.GetString( 8 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), sal_True ); // create a bool option for background - m_aUIProperties[5].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), aLocalizedStrings.GetString( 10 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), sal_True ); // create a bool option for black - m_aUIProperties[6].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), aLocalizedStrings.GetString( 12 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), sal_False ); - // create a bool option for hidden text - m_aUIProperties[7].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), + if (!bWeb) + { + // create a bool option for hidden text + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), aLocalizedStrings.GetString( 14 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), sal_False ); - // create a bool option for place holder - m_aUIProperties[8].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), + // create a bool option for place holder + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), aLocalizedStrings.GetString( 16 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), sal_False ); + } // create a list box for notes content Sequence< rtl::OUString > aChoices( 4 ); @@ -258,7 +258,7 @@ SwPrintUIOptions::SwPrintUIOptions() : Sequence< rtl::OUString > aHelpText( 2 ); aHelpText[0] = aLocalizedStrings.GetString( 18 ); aHelpText[1] = aLocalizedStrings.GetString( 18 ); - m_aUIProperties[9].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), aChoices, @@ -267,35 +267,38 @@ SwPrintUIOptions::SwPrintUIOptions() : ); // create Section for Page settings (results in an extra tab page in dialog) - m_aUIProperties[10].Value = getGroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); - // create a bool option for left pages - m_aUIProperties[11].Value = getBoolControlOpt( aLocalizedStrings.GetString( 24 ), + if (!bWeb) + { + // create a bool option for left pages + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 24 ), aLocalizedStrings.GetString( 25 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), sal_True ); - // create a bool option for right pages - m_aUIProperties[12].Value = getBoolControlOpt( aLocalizedStrings.GetString( 26 ), + // create a bool option for right pages + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 26 ), aLocalizedStrings.GetString( 27 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), sal_True ); + } // create a bool option for reversed order (solve in vcl ?) - m_aUIProperties[13].Value = getBoolControlOpt( aLocalizedStrings.GetString( 28 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 28 ), aLocalizedStrings.GetString( 29 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), sal_False ); // create a bool option for brochure OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); - m_aUIProperties[14].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), aLocalizedStrings.GetString( 31 ), aBrochurePropertyName, sal_False ); // create a bool option for brochure RTL dependent on brochure - m_aUIProperties[15].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), aLocalizedStrings.GetString( 33 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), sal_False, @@ -303,20 +306,21 @@ SwPrintUIOptions::SwPrintUIOptions() : ); // create subgroup for misc options - m_aUIProperties[16].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 34 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 34 ), rtl::OUString() ); // create a bool option for blank pages - m_aUIProperties[17].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), aLocalizedStrings.GetString( 36 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), sal_True ); // create a bool option for paper tray - m_aUIProperties[18].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), aLocalizedStrings.GetString( 38 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), sal_False ); + DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) @@ -2774,7 +2778,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( throw RuntimeException(); if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SwPrintUIOptions(); + { + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); SfxViewShell *pView = 0; @@ -2828,7 +2835,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( throw RuntimeException(); if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SwPrintUIOptions(); + { + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + } SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection ); @@ -2902,9 +2912,6 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOptions ) - m_pPrintUIOptions = new SwPrintUIOptions(); - SfxViewShell *pView = GuessViewShell(); SwDoc *pDoc = GetRenderDoc( pView, rSelection ); if (!pDoc || !pView) @@ -2955,11 +2962,35 @@ void SAL_CALL SwXTextDocument::render( if(pVwSh && pOut) { + if (!m_pPrintUIOptions) + { + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + } + m_pPrintUIOptions->processProperties( rxOptions ); + SwPrtOptions aOptions( C2U("PDF export") ); + // get print options to use from provided properties const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); + aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphics" ), aOptions.bPrintGraphic ); + aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( C2U( "PrintTables" ), aOptions.bPrintTable ); + aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( C2U( "PrintDrawings" ), aOptions.bPrintDraw ); + aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( C2U( "PrintControls" ), aOptions.bPrintControl ); + aOptions.bPrintLeftPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintLeftPages" ), aOptions.bPrintLeftPage ); + aOptions.bPrintRightPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintRightPages" ), aOptions.bPrintRightPage ); + aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( C2U( "PrintBackground" ), aOptions.bPrintPageBackground ); + aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( C2U( "PrintEmptyPages" ), aOptions.bPrintEmptyPages ); + aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( C2U( "PrintReverseOrder" ), aOptions.bPrintReverse ); + aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), aOptions.bPrintProspect ); + aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochureRTL" ), aOptions.bPrintProspect_RTL ); + aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( C2U( "PrintBlack" ), aOptions.bPrintBlackFont ); + aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( C2U( "PrintHiddenText" ), aOptions.bPrintHiddenText ); + aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( C2U( "PrintPlaceholder" ), aOptions.bPrintTextPlaceholder ); + aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( C2U( "PaperTray" ), aOptions.bPaperFromSetup ); + aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( C2U( "PrintNotes" ), aOptions.nPrintPostIts )); Range aPageRange( nRenderer+1, nRenderer+1 ); MultiSelection aPage( aPageRange ); @@ -2971,7 +3002,8 @@ void SAL_CALL SwXTextDocument::render( //! document is created that contains only the selects parts, //! and thus that document is to printed in whole the, //! aOptions.bPrintSelection parameter will be false. - aOptions.bPrintSelection = FALSE; + if (!m_pPrintUIOptions->getBoolValue( C2U( "IsPrinter" ), sal_False ) ) // PDF export? + aOptions.bPrintSelection = FALSE; SwViewOptionAdjust_Impl* pViewOptionAdjust = pView->IsA(aSwViewTypeId) ? new SwViewOptionAdjust_Impl(*((SwView*)pView)->GetWrtShellPtr()) : 0; -- cgit v1.2.3 From 2bf9e550715babfb280d482dd6c0dbed8ac0aa7e Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 14 May 2009 08:01:25 +0000 Subject: #i101241# new UI print dialog for Math --- starmath/source/view.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 99008589aeef..97a93bc6bb61 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1018,13 +1018,13 @@ void SmViewShell::Impl_Print( { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Impl_Print" ); - const bool bIsPrintTitle = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_TITLE_ROW ), sal_True ); - const bool bIsPrintFrame = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_BORDER ), sal_True ); - const bool bIsPrintFormulaText = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_FORMULA_TEXT ), sal_True ); - SmPrintSize ePrintSize( static_cast< SmPrintSize >( rPrintUIOptions.getIntValue( A2OU( PRTUIOPT_PRINT_FORMAT ), PRINT_SIZE_NORMAL ) )); - const USHORT nZoomFactor = static_cast< USHORT >(rPrintUIOptions.getIntValue( A2OU( PRTUIOPT_PRINT_SCALE ), 100 )); + const bool bIsPrintTitle = rPrintUIOptions.getBoolValue( PRTUIOPT_TITLE_ROW, sal_True ); + const bool bIsPrintFrame = rPrintUIOptions.getBoolValue( PRTUIOPT_BORDER, sal_True ); + const bool bIsPrintFormulaText = rPrintUIOptions.getBoolValue( PRTUIOPT_FORMULA_TEXT, sal_True ); + SmPrintSize ePrintSize( static_cast< SmPrintSize >( rPrintUIOptions.getIntValue( PRTUIOPT_PRINT_FORMAT, PRINT_SIZE_NORMAL ) )); + const USHORT nZoomFactor = static_cast< USHORT >(rPrintUIOptions.getIntValue( PRTUIOPT_PRINT_SCALE, 100 )); // IsIgnoreSpacesRight is a parser option! Thus it does not get evaluated here anymore (too late). -// const bool bNoRightSpaces = rPrintUIOptions.getBoolValue( A2OU( PRTUIOPT_NO_RIGHT_SPACE ), sal_True ); +// const bool bNoRightSpaces = rPrintUIOptions.getBoolValue( PRTUIOPT_NO_RIGHT_SPACE, sal_True ); rOutDev.Push(); rOutDev.SetLineColor( Color(COL_BLACK) ); @@ -1113,7 +1113,7 @@ void SmViewShell::Impl_Print( MapMode OutputMapMode; // PDF export should always use PRINT_SIZE_NORMAL ... - if (!rPrintUIOptions.getBoolValue( A2OU( "IsPrinter" ), sal_False ) ) + if (!rPrintUIOptions.getBoolValue( "IsPrinter", sal_False ) ) ePrintSize = PRINT_SIZE_NORMAL; switch (ePrintSize) { -- cgit v1.2.3 From 312a29be317f545d3cca07d08b60a660f4cc2710 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 14 May 2009 08:04:11 +0000 Subject: #i101241# new UI print dialog for Math --- starmath/source/unomodel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index b00deea40b38..73840d528ba8 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1100,7 +1100,7 @@ void SAL_CALL SmModel::render( // release SmPrintUIOptions when everything is done. // That way, when SmPrintUIOptions is needed again it will read the latest configuration settings in its c-tor. - if (m_pPrintUIOptions->getBoolValue( A2OU("IsLastPage"), sal_False )) + if (m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False )) { delete m_pPrintUIOptions; m_pPrintUIOptions = 0; } -- cgit v1.2.3 From 0f58a76df8f043959eb3de957514e8bdf57eeed9 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 22 May 2009 10:55:14 +0000 Subject: #i92516# print range needs to be app specific --- sw/source/ui/config/optdlg.src | 7 +++++++ sw/source/ui/uno/unotxdoc.cxx | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 067c4b445676..16d1c57b13ad 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -979,6 +979,13 @@ StringArray STR_PRINTOPTUI < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; < "~Paper tray from printer settings"; >; < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; + < "Print Range"; >; + < "~All pages"; >; + < "Print all pages of the document."; >; + < "~Pages"; >; + < "Print a range of pages of the document."; >; + < "~Selection"; >; + < "Print only the currently selected content."; >; }; }; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index dbb549e1e037..ab866e8d0194 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -183,13 +183,13 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 39, "resource incomplete" ); - if( aLocalizedStrings.Count() < 39 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 46, "resource incomplete" ); + if( aLocalizedStrings.Count() < 46 ) // bad resource ? return; // create sequence of print UI options // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 14 : 19; + const int nNumProps = bWeb? 17 : 22; m_aUIProperties.realloc( nNumProps ); int nIdx = 0; @@ -320,6 +320,33 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), sal_False ); + // print range selection + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), rtl::OUString(), true, true ); + + // create a choice for the content to create + rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); + aChoices.realloc( 3 ); + aHelpText.realloc( 3 ); + aChoices[0] = aLocalizedStrings.GetString( 40 ); + aHelpText[0] = aLocalizedStrings.GetString( 41 ); + aChoices[1] = aLocalizedStrings.GetString( 42 ); + aHelpText[1] = aLocalizedStrings.GetString( 43 ); + aChoices[2] = aLocalizedStrings.GetString( 44 ); + aHelpText[2] = aLocalizedStrings.GetString( 45 ); + m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), + aHelpText, + aPrintRangeName, + aChoices, + 0 ); + // create a an Edit dependent on "Pages" selected + m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), + rtl::OUString(), + &aPrintRangeName, 1 + ); + + DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } -- cgit v1.2.3 From a016e23729232a54ce03a1380032dfef3b5356de Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 27 May 2009 17:40:38 +0000 Subject: print range changes, dependency UI --- starmath/source/unomodel.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 73840d528ba8..29a8164c1309 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -147,8 +147,7 @@ SmPrintUIOptions::SmPrintUIOptions() pConfig->GetPrintZoomFactor(), // initial value 10, // min value 1000, // max value - &aPrintFormatProp, - 2 ); + &aPrintFormatProp, 2 , sal_True ); // IsIgnoreSpacesRight is a parser option! Thus we don't add it to the printer UI. // -- cgit v1.2.3 From 7103e2b01f89fe217949cc20929dab00d277d44f Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 27 May 2009 17:41:13 +0000 Subject: print range changes, dependency UI --- sw/source/ui/uno/unotxdoc.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index ab866e8d0194..0b5113611302 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -302,7 +302,9 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aLocalizedStrings.GetString( 33 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), sal_False, - &aBrochurePropertyName + &aBrochurePropertyName, + -1, + sal_True ); // create subgroup for misc options @@ -343,7 +345,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), rtl::OUString(), - &aPrintRangeName, 1 + &aPrintRangeName, 1, sal_True ); -- cgit v1.2.3 From a309b83c67d0d6cafa1471e901d37f2c3725c4b3 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 28 May 2009 16:52:32 +0000 Subject: #i96402# SetDuplexMode --- sw/source/core/view/vprint.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 740b06b39f7e..188ab5f78f78 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1373,7 +1373,7 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, // we are have an odd page count in collation/duplex // mode and there are still some copies to print: if ( pPrt && ( 1 == ( nPagesPrinted % 2 ) ) && - DUPLEX_ON == pPrt->GetDuplexMode() && + ( DUPLEX_SHORTEDGE == pPrt->GetDuplexMode() || DUPLEX_LONGEDGE == pPrt->GetDuplexMode() ) && nCnt + 1 < nCopyCnt ) { pPrt->StartPage(); -- cgit v1.2.3 From 5322b2a0c94772961310dc646a237df18cd20e6e Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 4 Jun 2009 08:23:53 +0000 Subject: #i101242# new print dialog UI --- sw/inc/unotxdoc.hxx | 2 +- sw/inc/viewsh.hxx | 11 +-- sw/source/core/doc/docdesc.cxx | 1 + sw/source/core/view/vnew.cxx | 8 +- sw/source/core/view/vprint.cxx | 190 +++++++++++++++++++++++----------------- sw/source/ui/app/docst.cxx | 1 + sw/source/ui/dbui/dbmgr.cxx | 4 +- sw/source/ui/uiview/pview.cxx | 2 +- sw/source/ui/uiview/viewprt.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 109 ++++++++++++++--------- 10 files changed, 199 insertions(+), 131 deletions(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index a5d840c1ac2b..77369c7a4840 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -224,7 +224,7 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, // used for XRenderable implementation SfxViewShell * GuessViewShell(); - SwDoc * GetRenderDoc( SfxViewShell *&rpView, const ::com::sun::star::uno::Any& rSelection ); + SwDoc * GetRenderDoc( SfxViewShell *&rpView, const ::com::sun::star::uno::Any& rSelection, bool bIsPDFExport ); rtl::OUString maBuildId; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index d73db5d79e0b..e531485bd6ad 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -39,6 +39,7 @@ #include #include #include +#include namespace com { namespace sun { namespace star { namespace accessibility { class XAccessible; } } } } @@ -210,7 +211,7 @@ public: //Nach Druckerwechsel, vom Doc //pPDFOut != NULL is used for PDF export. - void InitPrt( SfxPrinter * , OutputDevice *pPDFOut = NULL ); + void InitPrt( /*TLPDF Printer * ,*/ OutputDevice *pOutDev /* = NULL */ ); //Klammerung von zusammengehoerenden Aktionen. inline void StartAction(); @@ -362,16 +363,16 @@ public: void ChgAllPageSize( Size &rSz ); //Druckauftrag abwickeln. - // pPDFOut != Null is: do PDF Export (no printing!) - sal_Bool Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, - OutputDevice* pPDFOut = NULL ); + // bIsPDFExport == true is: do PDF Export (no printing!) + sal_Bool Prt( OutputDevice* pOutDev, SwPrtOptions& rOptions, SfxProgress* pProgress, + bool bIsPDFExport = false ); //"Drucken" fuer OLE 2.0 static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, OutputDevice* pOleOut, const Rectangle& rRect ); // creates temporary doc with selected text for PDF export - SwDoc * CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef& ); + SwDoc * CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef& ); SwDoc * FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt ); //Wird intern fuer die Shell gerufen die Druckt. Formatiert die Seiten. diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 736447dad6b2..ed8ac98e6cec 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -39,6 +39,7 @@ #include "svx/frmdiritem.hxx" #include #include +#include #include #include #include diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index a270c6f78492..8a89691eec06 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -108,6 +108,8 @@ void ViewShell::Init( const SwViewOption *pNewOpt ) // --> FME 2007-11-06 #i82967# OutputDevice* pPDFOut = 0; +// TLPDF if ( pOut && pOut->GetPDFWriter() ) +// TLPDF pPDFOut = pOut; if ( pOut && pOut->GetPDFWriter() ) pPDFOut = pOut; // <-- @@ -119,8 +121,10 @@ void ViewShell::Init( const SwViewOption *pNewOpt ) const bool bCreatePrinter = !bBrowseMode && !pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE); SfxPrinter* pPrinter = getIDocumentDeviceAccess()->getPrinter( bCreatePrinter ); - if( pPrinter ) - InitPrt( pPrinter, pPDFOut ); +// TLPDF if( pPrinter ) +// TLPDF InitPrt( pPrinter, pPDFOut ); + if( pPDFOut ) + InitPrt( pPDFOut ); // <-- // --> FME 2005-03-16 #i44963# Good occasion to check if page sizes in diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 188ab5f78f78..ba9f7ceee657 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -232,9 +232,10 @@ void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL bPDFExport ) aPt += pSh->aPrtOffst; aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y(); - OutputDevice *pOut = bPDFExport ? - pSh->GetOut() : - pSh->getIDocumentDeviceAccess()->getPrinter( false ); +// TLPDF OutputDevice *pOut = bPDFExport ? +// TLPDF pSh->GetOut() : +// TLPDF pSh->getIDocumentDeviceAccess()->getPrinter( false ); + OutputDevice *pOut = pSh->GetOut(); MapMode aMapMode( pOut->GetMapMode() ); aMapMode.SetOrigin( aPt ); @@ -518,23 +519,24 @@ void lcl_PrintPostItsEndPage( ViewShell* pPrtShell, } /****************************************************************************** - * Methode : void ViewShell::InitPrt( SfxPrinter *pNew, OutputDevice *pPDFOut ) + * Methode : void ViewShell::InitPrt( Printer *pNew, OutputDevice *pPDFOut ) * Beschreibung: * Erstellt : OK 07.11.94 10:22 * Aenderung : ******************************************************************************/ -void ViewShell::InitPrt( SfxPrinter *pPrt, OutputDevice *pPDFOut ) +void ViewShell::InitPrt( /*Printer *pPrt,*/ OutputDevice *pOutDev ) /* TLPDF */ { //Fuer den Printer merken wir uns einen negativen Offset, der //genau dem Offset de OutputSize entspricht. Das ist notwendig, //weil unser Ursprung der linken ober Ecke der physikalischen //Seite ist, die Ausgaben (SV) aber den Outputoffset als Urstprung //betrachten. - OutputDevice *pTmpDev = pPDFOut ? pPDFOut : (OutputDevice *) pPrt; + OutputDevice *pTmpDev = pOutDev; // TLPDF pPDFOut ? pPDFOut : (OutputDevice *) pPrt; if ( pTmpDev ) { - aPrtOffst = pPrt ? pPrt->GetPageOffset() : Point(); +// TLPDRF aPrtOffst = pPrt ? pPrt->GetPageOffset() : Point(); + aPrtOffst = Point(); aPrtOffst += pTmpDev->GetMapMode().GetOrigin(); MapMode aMapMode( pTmpDev->GetMapMode() ); @@ -745,7 +747,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, /******************************************************************************/ -SwDoc * ViewShell::CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef &rDocShellRef) +SwDoc * ViewShell::CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef &rDocShellRef) // TLPDF { ASSERT( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); SwFEShell* pFESh = (SwFEShell*)this; @@ -755,10 +757,11 @@ SwDoc * ViewShell::CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef &rDocShellR pPrtDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)rDocShellRef ); pPrtDoc->LockExpFlds(); +/* TLPDF // Der Drucker wird uebernommen if (pPrt) pPrtDoc->setPrinter( pPrt, true, true ); - +*/ const SfxPoolItem* pCpyItem; const SfxItemPool& rPool = GetAttrPool(); for( USHORT nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh ) @@ -831,6 +834,7 @@ SwDoc * ViewShell::CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef &rDocShellR } return pPrtDoc; } + SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) { ASSERT( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); @@ -922,22 +926,23 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) } /****************************************************************************** - * Methode : void ViewShell::Prt( const SwPrtOptions& rOptions, - * SfxProgress* pProgress, - * OutputDevice* pPDFOut ) + * Methode : void ViewShell::Prt * Beschreibung: * Erstellt : OK 04.11.94 15:33 * Aenderung : MA 10. May. 95 ******************************************************************************/ -BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, - OutputDevice* pPDFOut ) +BOOL ViewShell::Prt( + OutputDevice* pOutDev, + SwPrtOptions& rOptions, + SfxProgress* pProgress, + bool bIsPDFExport ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Immer die Druckroutine in viewpg.cxx (fuer Seitenvorschau) mitpflegen!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ASSERT( pPDFOut || pProgress, "Printing without progress bar!" ) + ASSERT( bIsPDFExport || pProgress, "Printing without progress bar!" ) BOOL bStartJob = FALSE; @@ -961,31 +966,31 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, ASSERT( aPages.Min() <= aPages.Max(), "MinSeite groesser MaxSeite." ); - SfxPrinter* pPrt = 0; //!! will be 0 for PDF export !! - if (pPDFOut) - pPDFOut->Push(); + Printer* pPrt = 0; //!! will be 0 for PDF export !! /*TLPDF*/ + if (bIsPDFExport) + pOutDev->Push(); else { - // wenn kein Drucker vorhanden ist, wird nicht gedruckt - pPrt = getIDocumentDeviceAccess()->getPrinter( false ); - if( !pPrt || !pPrt->GetName().Len() ) +#ifdef TL_NOT_NOW /*TLPDF*/ +// pOutDev = dynamic_cast< Printer* >(pOutDev); + DBG_ASSERT( pOutDev, "printer missing" ); + if( !pOutDev || !pOutDev->GetName().Len() ) { ASSERT( FALSE, "Drucken ohne Drucker?" ); return bStartJob; } - if( !rOptions.GetJobName().Len() && !pPrt->IsJobActive() ) + if( !rOptions.GetJobName().Len() && !pOutDev->IsJobActive() ) return bStartJob; +#endif // TL_NOT_NOW /*TLPDF*/ } // Einstellungen am Drucker merken - SwPrtOptSave aPrtSave( pPrt ); - - OutputDevice *pPrtOrPDFOut = pPDFOut ? pPDFOut : (OutputDevice *) pPrt; +// SwPrtOptSave aPrtSave( pOutDev ); /*TLPDF ???*/ // eine neue Shell fuer den Printer erzeugen ViewShell *pShell; - SwDoc *pPrtDoc; + SwDoc *pOutDevDoc; //!! muss warum auch immer hier in diesem scope existieren !! //!! (h?ngt mit OLE Objekten im Dokument zusammen.) @@ -999,18 +1004,26 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, // to be created that often here in the 'then' part. if ( bSelection ) { - pPrtDoc = CreatePrtDoc( pPrt, aDocShellRef ); + pOutDevDoc = CreatePrtDoc( /*TLPDF pOutDev,*/ aDocShellRef ); // eine ViewShell darauf - OutputDevice *pTmpDev = pPDFOut ? pPDFOut : 0; - pShell = new ViewShell( *pPrtDoc, 0, pOpt, pTmpDev ); - pPrtDoc->SetRefForDocShell( 0 ); +// TLPDF OutputDevice *pTmpDev = bIsPDFExport ? pOutDev : 0; +// TLPDF pShell = new ViewShell( *pOutDevDoc, 0, pOpt, pTmpDev ); + pShell = new ViewShell( *pOutDevDoc, 0, pOpt, pOutDev ); + pOutDevDoc->SetRefForDocShell( 0 ); } else { - pPrtDoc = GetDoc(); - OutputDevice *pTmpDev = pPDFOut ? pPDFOut : 0; - pShell = new ViewShell( *this, 0, pTmpDev ); + pOutDevDoc = GetDoc(); +// TLPDF OutputDevice *pTmpDev = bIsPDFExport ? pOutDev : 0; +// TLPDF pShell = new ViewShell( *this, 0, pTmpDev ); + pShell = new ViewShell( *this, 0, pOutDev ); + } + SdrView *pDrawView = pShell->GetDrawView(); + if (pDrawView) + { + pDrawView->SetBufferedOutputAllowed( false ); // TLPDF + pDrawView->SetBufferedOverlayAllowed( false ); // TLPDF } { //Zusaetzlicher Scope, damit die CurrShell vor dem zerstoeren der @@ -1018,11 +1031,13 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, SET_CURR_SHELL( pShell ); +#ifdef TL_NOT_NOW /*TLPDF*/ if ( pProgress ) { - Link aLnk = LINK(pShell->Imp(), SwViewImp, SetStopPrt); + Link aLnk = LINK(pShell->Imp(), SwViewImp, SetStopOutDev); ((SfxPrintProgress *)pProgress)->SetCancelHdl(aLnk); } +#endif // TL_NOT_NOW /*TLPDF*/ //JP 01.02.99: das ReadOnly Flag wird NIE mitkopiert; Bug 61335 if( pOpt->IsReadonly() ) @@ -1064,12 +1079,14 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, // --> FME 2004-06-21 #i9684# For performance reasons, we do not update // the fields during pdf export. // #i56195# prevent update of fields (for mail merge) - if ( !pPDFOut && rOptions.bUpdateFieldsInPrinting ) + if ( !bIsPDFExport && rOptions.bUpdateFieldsInPrinting ) // <-- pShell->UpdateFlds(TRUE); - if( !pShell->Imp()->IsStopPrt() && - ( pPDFOut || rOptions.GetJobName().Len() || pPrt->IsJobActive()) ) +// TLPDF if( !pShell->Imp()->IsStopOutDev() && +// TLPDF ( bIsPDFExport || rOptions.GetJobName().Len() || pOutDev->IsJobActive()) ) + if( /*!pShell->Imp()->IsStopOutDev() && */ + ( bIsPDFExport || rOptions.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; @@ -1087,25 +1104,26 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, USHORT nFirstPageNo = 0; USHORT nLastPageNo = 0; USHORT nPageNo = 1; - - if (pPrt) +#ifdef TL_NOT_NOW /*TLPDF*/ + if (pOutDev) { if( rOptions.IsPrintSingleJobs() && sJobName.Len() && ( bStartJob || rOptions.bJobStartet ) ) { - pPrt->EndJob(); + pOutDev->EndJob(); bStartJob = FALSE; rOptions.bJobStartet = TRUE; // Reschedule statt Yield, da Yield keine Events abarbeitet // und es sonst eine Endlosschleife gibt. - while( pPrt->IsPrinting() && pProgress ) + while( pOutDev->IsPrinting() && pProgress ) pProgress->Reschedule(); sJobName = rOptions.MakeNextJobName(); nJobStartError = JOBSET_ERR_DEFAULT; } } +#endif //TL_NOT_NOW /*TLPDF*/ for( USHORT i = 1; i <= (USHORT)aPages.Max(); ++i ) { @@ -1183,8 +1201,10 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, { lcl_GetPostIts( pDoc, aPostItFields ); pPostItDoc = new SwDoc; - if (pPrt) - pPostItDoc->setPrinter( pPrt, true, true ); +/* TLPDF + if (pOutDev) + pPostItDoc->setPrinter( pOutDev, true, true ); +*/ pPostItShell = new ViewShell( *pPostItDoc, 0, pShell->GetViewOptions() ); // Wenn PostIts am Dokumentenende gedruckt werden sollen, @@ -1205,13 +1225,15 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, BOOL bSetPaperSz = FALSE; BOOL bSetPaperBin = FALSE; BOOL bSetPrt = FALSE; - if (pPrt) + if (pOutDev) { - bSetOrient = pPrt->HasSupport( SUPPORT_SET_ORIENTATION ); - bSetPaperSz = pPrt->HasSupport( SUPPORT_SET_PAPERSIZE ); +#ifdef TL_NOT_NOW /*TLPDF*/ + bSetOrient = pOutDev->HasSupport( SUPPORT_SET_ORIENTATION ); + bSetPaperSz = pOutDev->HasSupport( SUPPORT_SET_PAPERSIZE ); bSetPaperBin = !rOptions.bPaperFromSetup && - pPrt->HasSupport( SUPPORT_SET_PAPERBIN ); + pOutDev->HasSupport( SUPPORT_SET_PAPERBIN ); bSetPrt = bSetOrient || bSetPaperSz || bSetPaperBin; +#endif // TL_NOT_NOW /*TLPDF*/ } if ( rOptions.nPrintPostIts != POSTITS_ONLY ) @@ -1231,28 +1253,30 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, if ( pProgress ) pProgress->Reschedule(); - if (pPrt) +#ifdef TL_NOT_NOW /*TLPDF*/ + if (pOutDev) { if ( JOBSET_ERR_ERROR == nJobStartError || - ( !pPrt->IsJobActive() && ( !sJobName.Len() || bStartJob ) ) || - pShell->Imp()->IsStopPrt() ) + ( !pOutDev->IsJobActive() && ( !sJobName.Len() || bStartJob ) ) || + pShell->Imp()->IsStopOutDev() ) { bStop = TRUE; break; } } +#endif // TL_NOT_NOW /*TLPDF*/ - ::SetSwVisArea( pShell, pStPage->Frm(), 0 != pPDFOut ); + ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // wenn wir einen Umschlag drucken wird ein Offset beachtet if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) { - aOldMapMode = pPrtOrPDFOut->GetMapMode(); - Point aNewOrigin = pPrtOrPDFOut->GetMapMode().GetOrigin(); + aOldMapMode = pOutDev->GetMapMode(); + Point aNewOrigin = pOutDev->GetMapMode().GetOrigin(); aNewOrigin += rOptions.aOffset; - MapMode aTmp( pPrtOrPDFOut->GetMapMode() ); + MapMode aTmp( pOutDev->GetMapMode() ); aTmp.SetOrigin( aNewOrigin ); - pPrtOrPDFOut->SetMapMode( aTmp ); + pOutDev->SetMapMode( aTmp ); } const BOOL bRightPg = pStPage->OnRightPage(); @@ -1271,22 +1295,27 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, const BOOL bLandScp = rFormatPage.GetPageDesc()->GetLandscape(); +#ifdef TL_NOT_NOW /*TLPDF*/ if( bSetPaperBin ) // Schacht einstellen. - pPrt->SetPaperBin( rFormatPage.GetFmt()-> + pOutDev->SetPaperBin( rFormatPage.GetFmt()-> GetPaperBin().GetValue() ); +#endif // TL_NOT_NOW /*TLPDF*/ if (bSetOrient ) { +#ifdef TL_NOT_NOW /*TLPDF*/ // Orientation einstellen: Breiter als Hoch // -> Landscape, sonst -> Portrait. if( bLandScp ) - pPrt->SetOrientation(ORIENTATION_LANDSCAPE); + pOutDev->SetOrientation(ORIENTATION_LANDSCAPE); else - pPrt->SetOrientation(ORIENTATION_PORTRAIT); + pOutDev->SetOrientation(ORIENTATION_PORTRAIT); +#endif // TL_NOT_NOW /*TLPDF*/ } if (bSetPaperSz ) { +#ifdef TL_NOT_NOW /*TLPDF*/ Size aSize = pStPage->Frm().SSize(); if ( bLandScp && bSetOrient ) { @@ -1299,9 +1328,10 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, } Paper ePaper = SvxPaperInfo::GetSvPaper(aSize,MAP_TWIP,TRUE); if ( PAPER_USER == ePaper ) - pPrt->SetPaperSizeUser( aSize ); + pOutDev->SetPaperSizeUser( aSize ); else - pPrt->SetPaper( ePaper ); + pOutDev->SetPaper( ePaper ); +#endif // TL_NOT_NOW /*TLPDF*/ } } } @@ -1323,33 +1353,36 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError && sJobName.Len() ) { - if( pPrt && !pPrt->IsJobActive() ) +#ifdef TL_NOT_NOW /*TLPDF*/ + if( pOutDev && !pOutDev->IsJobActive() ) { - bStartJob = pPrt->StartJob( sJobName ); + bStartJob = pOutDev->StartJob( sJobName ); if( !bStartJob ) { nJobStartError = JOBSET_ERR_ERROR; continue; } } +#endif // TL_NOT_NOW /*TLPDF*/ - pShell->InitPrt( pPrt, pPDFOut ); +// TLPDF pShell->InitPrt( pOutDev, bIsPDFExport ? pOutDev : 0 ); + pShell->InitPrt( pOutDev ); - ::SetSwVisArea( pShell, pStPage->Frm(), 0 != pPDFOut ); + ::SetSwVisArea( pShell, pStPage->Frm(), TRUE /*bIsPDFExport*/ ); // TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages if ( rOptions.bPrintEmptyPages || pStPage->Frm().Height() ) // <-- { - if (pPrt) - pPrt->StartPage(); +// TLPDF if (pOutDev) +// TLPDF pOutDev->StartPage(); pStPage->GetUpper()->Paint( pStPage->Frm() ); ++nPagesPrinted; - if (pPrt) - pPrt->EndPage(); +// TLPDF if (pOutDev) +// TLPDF pOutDev->EndPage(); } SwPaintQueue::Repaint(); @@ -1365,10 +1398,11 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, // den eventl. fuer Umschlaege modifizierte OutDevOffset wieder // zuruecksetzen. if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) - pPrtOrPDFOut->SetMapMode( aOldMapMode ); + pOutDev->SetMapMode( aOldMapMode ); if ( pStPage == pEndPage ) { +#ifdef TL_NOT_NOW /*TLPDF*/ // --> FME 2005-01-05 #110536# Print emtpy page if // we are have an odd page count in collation/duplex // mode and there are still some copies to print: @@ -1376,11 +1410,11 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, ( DUPLEX_SHORTEDGE == pPrt->GetDuplexMode() || DUPLEX_LONGEDGE == pPrt->GetDuplexMode() ) && nCnt + 1 < nCopyCnt ) { - pPrt->StartPage(); - pPrt->EndPage(); + pOutDev->StartPage(); + pOutDev->EndPage(); } // <-- - +#endif // TL_NOT_NOW /*TLPDF*/ pStPage = 0; } else if ( rOptions.bPrintReverse ) @@ -1425,15 +1459,15 @@ BOOL ViewShell::Prt( SwPrtOptions& rOptions, SfxProgress* pProgress, if (bSelection ) { // damit das Dokument nicht den Drucker mit ins Grab nimmt - pPrtDoc->setPrinter( 0, false, false ); + pOutDevDoc->setPrinter( 0, false, false ); - if ( !pPrtDoc->release() ) - delete pPrtDoc; + if ( !pOutDevDoc->release() ) + delete pOutDevDoc; } - // restore settings of OutputDevicef - if (pPDFOut) - pPDFOut->Pop(); + // restore settings of OutputDevice + if (bIsPDFExport) + pOutDev->Pop(); return bStartJob; } diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index cd98bb0cb554..9d624c2f5179 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index bf6bef6959b3..17d2ad5ef31d 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -988,7 +988,7 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, bRet = TRUE; } } - else if( pSh->Prt( rOpt, &rProgress ) ) + else if( pSh->Prt( pPrt, rOpt, &rProgress ) ) /* TLPDF */ bRet = TRUE; bMergeLock = FALSE; @@ -1145,7 +1145,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, bRet = TRUE; } } - else if( pSh->Prt( rOpt, &rProgress ) ) + else if( pSh->Prt( pPrt, rOpt, &rProgress ) ) /* TLPDF */ bRet = TRUE; bMergeLock = FALSE; diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 7c12f537761e..a9b36d255a23 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -2470,7 +2470,7 @@ USHORT SwPagePreView::Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog * if( bPrtPros ) pSh->PrintProspect( aOpts, rProgress, bPrtPros_RTL ); else - pSh->Prt( aOpts, &rProgress ); + pSh->Prt( pPrinter, aOpts, &rProgress ); /*TLPDF*/ } else { diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 6d219e71ab30..38e931b73826 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -392,7 +392,7 @@ ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, pSh->PrintProspect( aOpts, *pProgress, bPrtPros_RTL ); } else - bStartJob = pSh->Prt( aOpts, pProgress ); + bStartJob = pSh->Prt( pPrinter, aOpts, pProgress ); /*TLPDF*/ if ( bBrowse ) { diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 0b5113611302..f482c2436b0c 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -308,7 +309,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : ); // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 34 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 34 ) ), rtl::OUString() ); // create a bool option for blank pages m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), @@ -2758,8 +2759,9 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() * SfxViewShell. */ -SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rSelection ) +SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rSelection, bool bIsPDFExport ) { + (void) bIsPDFExport; SwDoc *pDoc = 0; uno::Reference< frame::XModel > xModel; @@ -2768,6 +2770,11 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS pDoc = pDocShell->GetDoc(); else { + // important check since GuessViewShell below should only get called for PDF export. + // Otherwise the View should be obtained from the "View" property passed on in the + // calls to the XRenderable functions. + DBG_ASSERT( bIsPDFExport, "code should have been called for PDF export only..." ); + // used for PDF export of (multi-)selection if (rSelection.hasValue()) // is anything selected ? { @@ -2812,18 +2819,19 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; - SwDoc *pDoc = GetRenderDoc( pView, rSelection ); + SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); if (!pDoc) throw RuntimeException(); SwDocShell *pRenderDocShell = pDoc->GetDocShell(); - // #i38289 - if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE)) - { - pRenderDocShell->ToggleBrowserMode(false,NULL); - } + // #i38289 + if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE) /*TLPDF for printing as well?*/) + { + pRenderDocShell->ToggleBrowserMode(false,NULL); + } SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell(); @@ -2839,12 +2847,16 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( SwViewOptionAdjust_Impl aAdjust(*pWrtShell); if( bFormat ) { - pWrtShell->SetPDFExportOption( sal_True ); + if (bIsPDFExport) + pWrtShell->SetPDFExportOption( sal_True ); + // --> FME 2005-05-23 #122919# Force field update before PDF export: pWrtShell->ViewShell::UpdateFlds(TRUE); // <-- pWrtShell->CalcLayout(); - pWrtShell->SetPDFExportOption( sal_False ); + + if (bIsPDFExport) + pWrtShell->SetPDFExportOption( sal_False ); } nRet = pDoc->GetPageCount(); @@ -2868,9 +2880,11 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } + m_pPrintUIOptions->processProperties( rxOptions ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; - SwDoc *pDoc = GetRenderDoc( pView, rSelection ); + SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); if (!pDoc) throw RuntimeException(); @@ -2882,13 +2896,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (nRenderer >= pDoc->GetPageCount()) return uno::Sequence< beans::PropertyValue >(); - bool bSkipEmptyPages = false; - for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) - { - if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ) ) - rxOptions[ nProperty].Value >>= bSkipEmptyPages; - } - + bool bSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bSkipEmptyPages ) ); awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), @@ -2941,8 +2949,31 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); - SfxViewShell *pView = GuessViewShell(); - SwDoc *pDoc = GetRenderDoc( pView, rSelection ); + if (!m_pPrintUIOptions) + { + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + } + m_pPrintUIOptions->processProperties( rxOptions ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + + // get view shell to use + SfxViewShell *pView = 0; + if (bIsPDFExport) + pView = GuessViewShell(); + else + { + uno::Any aTmp( m_pPrintUIOptions->getValue( C2U("View") ) ); + uno::Reference< frame::XController > xController; + if (aTmp >>= xController) + { + const SfxBaseController *pController = dynamic_cast< const SfxBaseController * >( xController.get() ); + pView = pController ? pController->GetViewShell_Impl() : 0; + } + } + + SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); + if (!pDoc || !pView) throw RuntimeException(); @@ -2967,7 +2998,6 @@ void SAL_CALL SwXTextDocument::render( bool bLastPage = false; rtl::OUString aPages; bool bSkipEmptyPages = false; - for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) { if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) @@ -2991,13 +3021,6 @@ void SAL_CALL SwXTextDocument::render( if(pVwSh && pOut) { - if (!m_pPrintUIOptions) - { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); - } - m_pPrintUIOptions->processProperties( rxOptions ); - SwPrtOptions aOptions( C2U("PDF export") ); // get print options to use from provided properties @@ -3031,14 +3054,14 @@ void SAL_CALL SwXTextDocument::render( //! document is created that contains only the selects parts, //! and thus that document is to printed in whole the, //! aOptions.bPrintSelection parameter will be false. - if (!m_pPrintUIOptions->getBoolValue( C2U( "IsPrinter" ), sal_False ) ) // PDF export? + if (bIsPDFExport) aOptions.bPrintSelection = FALSE; SwViewOptionAdjust_Impl* pViewOptionAdjust = pView->IsA(aSwViewTypeId) ? new SwViewOptionAdjust_Impl(*((SwView*)pView)->GetWrtShellPtr()) : 0; - - pVwSh->SetPDFExportOption( sal_True ); + if (bIsPDFExport) + pVwSh->SetPDFExportOption( sal_True ); // --> FME 2004-06-08 #i12836# enhanced pdf export // @@ -3050,13 +3073,14 @@ void SAL_CALL SwXTextDocument::render( ((SwView*)pView)->GetWrtShellPtr() : 0; - if ( bFirstPage && pWrtShell ) + if (bIsPDFExport && bFirstPage && pWrtShell) /*TLPDF*/ { SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPages, bSkipEmptyPages, sal_False ); } // <-- - pVwSh->Prt( aOptions, 0, pOut ); + OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF + pVwSh->Prt( pOut, aOptions, 0, bIsPDFExport ); // --> FME 2004-10-08 #i35176# // @@ -3064,25 +3088,28 @@ void SAL_CALL SwXTextDocument::render( // from the EditEngine. The links are generated during the painting // process, but the destinations are still missing. // - if ( bLastPage && pWrtShell ) + if (bIsPDFExport && bLastPage && pWrtShell) /*TLPDF*/ { SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPages, bSkipEmptyPages, sal_True ); } // <-- - pVwSh->SetPDFExportOption( sal_False ); + if (bIsPDFExport) + pVwSh->SetPDFExportOption( sal_False ); + // #i96167# haggai: delete pViewOptionsAdjust here because it makes use // of the shell, which might get destroyed in lcl_DisposeView! delete pViewOptionAdjust; - if( bLastPage && m_pHiddenViewFrame) + if (bLastPage) { - lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); - m_pHiddenViewFrame = 0; - } - - if( bLastPage ) + if (m_pHiddenViewFrame) + { + lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); + m_pHiddenViewFrame = 0; + } delete m_pPrintUIOptions, m_pPrintUIOptions = NULL; + } } } /* -----------------------------03.10.04 ------------------------------------- -- cgit v1.2.3 From 73220d96bca7cb760051144a5ea731119287d9f1 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 4 Jun 2009 09:53:01 +0000 Subject: removed warnings --- sw/source/core/view/vnew.cxx | 6 +++--- sw/source/core/view/vprint.cxx | 6 +++++- sw/source/ui/uno/unotxdoc.cxx | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 8a89691eec06..f5a132284021 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -118,9 +118,9 @@ void ViewShell::Init( const SwViewOption *pNewOpt ) // Only setup the printer if we need one: const IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); const bool bBrowseMode = pIDSA->get(IDocumentSettingAccess::BROWSE_MODE); - const bool bCreatePrinter = !bBrowseMode && - !pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE); - SfxPrinter* pPrinter = getIDocumentDeviceAccess()->getPrinter( bCreatePrinter ); +// TLPDF const bool bCreatePrinter = !bBrowseMode && +// TLPDF !pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE); +// TLPDF SfxPrinter* pPrinter = getIDocumentDeviceAccess()->getPrinter( bCreatePrinter ); // TLPDF if( pPrinter ) // TLPDF InitPrt( pPrinter, pPDFOut ); if( pPDFOut ) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ba9f7ceee657..e04e898d17c2 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -966,7 +966,9 @@ BOOL ViewShell::Prt( ASSERT( aPages.Min() <= aPages.Max(), "MinSeite groesser MaxSeite." ); +#ifdef TL_NOT_NOW /*TLPDF*/ Printer* pPrt = 0; //!! will be 0 for PDF export !! /*TLPDF*/ +#endif // TL_NOT_NOW /*TLPDF*/ if (bIsPDFExport) pOutDev->Push(); else @@ -1223,7 +1225,9 @@ BOOL ViewShell::Prt( const SwPageDesc *pLastPageDesc = NULL; BOOL bSetOrient = FALSE; BOOL bSetPaperSz = FALSE; +#ifdef TL_NOT_NOW /*TLPDF*/ BOOL bSetPaperBin = FALSE; +#endif // TL_NOT_NOW /*TLPDF*/ BOOL bSetPrt = FALSE; if (pOutDev) { @@ -1293,9 +1297,9 @@ BOOL ViewShell::Prt( { pLastPageDesc = rFormatPage.GetPageDesc(); +#ifdef TL_NOT_NOW /*TLPDF*/ const BOOL bLandScp = rFormatPage.GetPageDesc()->GetLandscape(); -#ifdef TL_NOT_NOW /*TLPDF*/ if( bSetPaperBin ) // Schacht einstellen. pOutDev->SetPaperBin( rFormatPage.GetFmt()-> GetPaperBin().GetValue() ); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index f482c2436b0c..6cf2f20d7503 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -3079,7 +3079,7 @@ void SAL_CALL SwXTextDocument::render( } // <-- - OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF + // TLPDF OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF pVwSh->Prt( pOut, aOptions, 0, bIsPDFExport ); // --> FME 2004-10-08 #i35176# -- cgit v1.2.3 -- cgit v1.2.3 From f40c3598c55e8be6c343890081edf68872de06b1 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 11 Jun 2009 16:36:55 +0000 Subject: solve a merge problem --- starmath/source/unomodel.cxx | 2 -- starmath/source/view.cxx | 1 - 2 files changed, 3 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 3491044e35b5..241415ef0b22 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -79,8 +79,6 @@ using namespace ::com::sun::star::script; #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define A2OU(cChar) rtl::OUString::createFromAscii(cChar) - //////////////////////////////////////////////////////////// SmPrintUIOptions::SmPrintUIOptions() diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 2b84c4dfc424..f229293b6b9d 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -70,7 +70,6 @@ #include #include "unomodel.hxx" -#include "mathml.hxx" #include "view.hxx" #include "config.hxx" #include "dialog.hxx" -- cgit v1.2.3 From c8bc5be2dca2dbe7e9cba1c9027f2c97076e8374 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 11 Jun 2009 17:26:10 +0000 Subject: make compile again, needs adaption ? --- sw/source/core/view/viewpg.cxx | 19 +++++++++++++++++-- sw/source/core/view/vprint.cxx | 10 +++++++++- sw/source/ui/dbui/dbmgr.cxx | 8 +++++++- sw/source/ui/uiview/srcview.cxx | 7 ++++++- sw/source/ui/uiview/viewprt.cxx | 7 ++++++- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index cad53470e95b..7051b58aa1dd 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -150,7 +150,9 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, if( rOptions.IsPrintSingleJobs() && rOptions.GetJobName().Len() && ( bStartJob || rOptions.bJobStartet ) ) { +#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->EndJob(); +#endif rOptions.bJobStartet = TRUE; // Reschedule statt Yield, da Yield keine Events abarbeitet @@ -159,7 +161,9 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, rProgress.Reschedule(); rOptions.MakeNextJobName(); - bStartJob = pPrt->StartJob( rOptions.GetJobName() ); +#ifdef TL_NOT_NOW /*TLPDF*/ + // bStartJob = pPrt->StartJob( rOptions.GetJobName() ); +#endif } const SwPageFrm *pStPage = (SwPageFrm*)GetLayout()->Lower(); @@ -340,7 +344,9 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, // dann kann das drucken losgehen rProgress.SetState( nPrintCount++, nSelCount ); +#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->StartPage(); +#endif Point aCalcPt; SwPageFrm** ppTmpPg = aPageArr; @@ -401,7 +407,9 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, } aCalcPt.Y() += nVOffs + nPageHeight; } +#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->EndPage(); +#endif SwPaintQueue::Repaint(); memset( aPageArr, 0, sizeof( SwPageFrm* ) * nPages ); @@ -569,7 +577,9 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, if( rOptions.IsPrintSingleJobs() && rOptions.GetJobName().Len() && ( bStartJob || rOptions.bJobStartet ) ) { +#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->EndJob(); +#endif rOptions.bJobStartet = TRUE; // Reschedule statt Yield, da Yield keine Events abarbeitet @@ -578,7 +588,8 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, rProgress.Reschedule(); rOptions.MakeNextJobName(); - bStartJob = pPrt->StartJob( rOptions.GetJobName() ); + DBG_ERROR( "StartJob does not exist anymore" ); + // bStartJob = pPrt->StartJob( rOptions.GetJobName() ); } // dann sorge mal dafuer, das alle Seiten in der richtigen @@ -714,7 +725,9 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, bStartJob = TRUE; rProgress.SetState( nPrintCount, nCntPage ); +#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->StartPage(); +#endif Point aSttPt; for( int nC = 0; nC < 2; ++nC ) @@ -736,7 +749,9 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, aSttPt.X() += aTmpPrtSize.Width() / 2; } +#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->EndPage(); +#endif SwPaintQueue::Repaint(); nSPg = nSPg + nStep; nEPg = nEPg - nStep; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index e04e898d17c2..e31da015f01f 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -381,6 +381,7 @@ void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItF void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, BOOL& rStartJob, int& rJobStartError, BOOL bReverse) { +#ifdef TL_NOT_NOW /*TLPDF*/ // Formatieren und Ausdrucken pPrtShell->CalcLayout(); @@ -427,6 +428,13 @@ void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, pPrn->EndPage(); pPage = bReverse ? pPage->GetPrev() : pPage->GetNext(); } + #else + (void)pPrtShell; + (void)rJobName; + (void)rStartJob; + (void)rJobStartError; + (void)bReverse; + #endif } /****************************************************************************** @@ -934,7 +942,7 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) BOOL ViewShell::Prt( - OutputDevice* pOutDev, + OutputDevice* pOutDev, SwPrtOptions& rOptions, SfxProgress* pProgress, bool bIsPDFExport ) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index d123dec5e0dd..f64d0e0b4512 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -976,12 +976,14 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, bMergeLock = TRUE; if(rOpt.IsPrintProspect()) { +#ifdef TL_NOT_NOW /*TLPDF*/ if( ! pPrt->IsJobActive() ) { pPrt->SetJobValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); pPrt->StartJob( rOpt.GetJobName() ); } +#endif if( pPrt->IsJobActive() ) { pSh->PrintProspect( rOpt, rProgress, rOpt.IsPrintProspect_RTL() ); @@ -1139,7 +1141,11 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, bMergeLock = TRUE; if(rOpt.IsPrintProspect()) { - if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) + if( pPrt->IsJobActive() +#ifdef TL_NOT_NOW /*TLPDF*/ + || pPrt->StartJob( rOpt.GetJobName() ) +#endif + ) { pSh->PrintProspect( rOpt, rProgress, rOpt.IsPrintProspect_RTL() ); bRet = TRUE; diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 7898e4db1cb2..72a99e79240e 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -753,8 +753,9 @@ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwSrcView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, BOOL bIsAPI ) +ErrCode SwSrcView::DoPrint( SfxPrinter */*pPrinter*/, PrintDialog */*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { + #if 0 SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); SfxPrinter *pDocPrinter = GetPrinter(TRUE); if ( !pPrinter ) @@ -845,6 +846,10 @@ ErrCode SwSrcView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilen pProgress->DeleteOnEndPrint(); pPrinter->EndJob(); return pPrinter->GetError(); + #else + DBG_ERROR( "dead code" ); + return ERRCODE_IO_NOTSUPPORTED; + #endif } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 38e931b73826..23f952b5bcf1 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -174,8 +174,9 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, BOOL bIsAPI ) +ErrCode SwView::DoPrint( SfxPrinter */*pPrinter*/, PrintDialog */*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { + #if 0 // First test SwWrtShell* pSh = &GetWrtShell(); SwNewDBMgr* pMgr = pSh->GetNewDBMgr(); @@ -434,6 +435,10 @@ ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, pProgress->DeleteOnEndPrint(); pPrinter->EndJob(); return pPrinter->GetError(); + #else + DBG_ERROR( "dead code" ); + return ERRCODE_IO_NOTSUPPORTED; + #endif } -- cgit v1.2.3 From 3269764069d16788c2534655e7900bf5606d6aa7 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 12 Jun 2009 15:22:27 +0000 Subject: #i92516# remove old StartPage/EndPage API --- sw/source/ui/dbui/dbmgr.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index f64d0e0b4512..0f7c203195be 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -904,9 +904,11 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, pModOpt->SetSinglePrintJob(rOpt.IsPrintSingleJobs()); SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); +#ifdef TL_NOT_NOW /*TLPDF*/ Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); if( rOpt.IsPrintSingleJobs() ) pPrt->SetEndPrintHdl( Link() ); +#endif BOOL bUserBreak = FALSE, bRet = FALSE; @@ -1009,6 +1011,7 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; } while( bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()); +#ifdef TL_NOT_NOW /*TLPDF*/ if( rOpt.IsPrintSingleJobs() ) { SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); @@ -1016,6 +1019,7 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? aSfxSaveLnk.Call( pTmpPrinter ); } +#endif rOpt.nMergeCnt = 0; rOpt.nMergeAct = 0; @@ -1048,9 +1052,11 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, rOpt.SetPrintSingleJobs( sal_True ); SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); +#ifdef TL_NOT_NOW /*TLPDF*/ Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); if( rOpt.IsPrintSingleJobs() ) pPrt->SetEndPrintHdl( Link() ); +#endif BOOL bUserBreak = FALSE, bRet = FALSE; @@ -1168,6 +1174,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, } } +#ifdef TL_NOT_NOW /*TLPDF*/ if( rOpt.IsPrintSingleJobs() ) { SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); @@ -1175,6 +1182,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? aSfxSaveLnk.Call( pTmpPrinter ); } +#endif rOpt.nMergeCnt = 0; rOpt.nMergeAct = 0; -- cgit v1.2.3 From f3cbe8e3d4097f79b33db3a9678ad475385ec425 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 15 Jun 2009 08:53:01 +0000 Subject: remove a warning --- sw/source/ui/uiview/viewprt.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 23f952b5bcf1..a6faae1894da 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -174,7 +174,7 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwView::DoPrint( SfxPrinter */*pPrinter*/, PrintDialog */*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) +ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { #if 0 // First test -- cgit v1.2.3 From ed4721887cd14279f5de473fac41ba8b9df12a7d Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 15 Jun 2009 18:03:16 +0000 Subject: solve a warning --- sw/source/ui/uiview/srcview.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 72a99e79240e..fdbfb6a8309b 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -753,7 +753,7 @@ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwSrcView::DoPrint( SfxPrinter */*pPrinter*/, PrintDialog */*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) +ErrCode SwSrcView::DoPrint( SfxPrinter * /*pPrinter*/, PrintDialog * /*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { #if 0 SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); -- cgit v1.2.3 From 2d2f137008a6f2599acd43f59f8b169075fa6f11 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 16 Jun 2009 10:00:34 +0000 Subject: #i101242# build problems fixed; XUNoTunnel added to SwXTextView --- sw/inc/dbgoutsw.hxx | 4 ++-- sw/source/ui/inc/unotxvw.hxx | 6 ++++++ sw/source/ui/uno/unotxdoc.cxx | 12 ++++++++++-- sw/source/ui/uno/unotxvw.cxx | 25 +++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx index 329c81b7fb38..26dc49d1fa27 100644 --- a/sw/inc/dbgoutsw.hxx +++ b/sw/inc/dbgoutsw.hxx @@ -118,7 +118,7 @@ const char * dbg_out(const std::hash_map & rMap) { return dbg_out(lcl_dbg_out(rMap)); } -const char * dbg_out(const SwFormToken & rToken); -const char * dbg_out(const SwFormTokens & rTokens); +SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken); +SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens); #endif // DEBUG #endif // __DBGOUTSW_HXX diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx index 4db18720cf87..794371499186 100644 --- a/sw/source/ui/inc/unotxvw.hxx +++ b/sw/source/ui/inc/unotxvw.hxx @@ -72,6 +72,7 @@ class SwXTextView : public ::com::sun::star::view::XViewSettingsSupplier, public ::com::sun::star::beans::XPropertySet, public ::com::sun::star::datatransfer::XTransferableSupplier, + public ::com::sun::star::lang::XUnoTunnel, public SfxBaseController { SelectionChangeListenerArr aSelChangedListeners; @@ -152,6 +153,11 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException); + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + void NotifySelChanged(); void NotifyDBChanged(); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index e1218b9c8d9e..a71f1f9f8a27 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -2962,8 +2963,15 @@ void SAL_CALL SwXTextDocument::render( uno::Reference< frame::XController > xController; if (aTmp >>= xController) { - const SfxBaseController *pController = dynamic_cast< const SfxBaseController * >( xController.get() ); - pView = pController ? pController->GetViewShell_Impl() : 0; + uno::Reference< lang::XUnoTunnel > xTunnel( xController, uno::UNO_QUERY ); + if (xTunnel.is()) + { + SwXTextView *pTextView = reinterpret_cast< SwXTextView * >( + sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXTextView::getUnoTunnelId()) )); + if (pTextView) + pView = pTextView->GetView(); + } + } } diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index eaba514a6e6a..2f3bb43fcb78 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -295,6 +295,11 @@ uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType ) uno::Reference xRet = this; aRet.setValue(&xRet, aType); } + else if(aType == ::getCppuType((uno::Reference*)0)) + { + uno::Reference xRet = this; + aRet.setValue(&xRet, aType); + } else aRet = SfxBaseController::queryInterface(aType); return aRet; @@ -2216,5 +2221,25 @@ void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfe } } } + +const uno::Sequence< sal_Int8 > & SwXTextView::getUnoTunnelId() +{ + static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); + return aSeq; +} + +sal_Int64 SAL_CALL SwXTextView::getSomething( + const uno::Sequence< sal_Int8 >& rId ) +throw(uno::RuntimeException) +{ + if( rId.getLength() == 16 + && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + } + return 0; +} + // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 6f62d05aa6ab5d3517ba94ccfabef1072e00e534 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 9 Jul 2009 08:21:58 +0000 Subject: #i101242# new print UI dialog --- sw/source/core/view/vprint.cxx | 126 +++++++++++++++++++---------------- sw/source/ui/uno/unotxdoc.cxx | 146 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+), 55 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index e31da015f01f..9d8fd79c139c 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -381,7 +381,7 @@ void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItF void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, BOOL& rStartJob, int& rJobStartError, BOOL bReverse) { -#ifdef TL_NOT_NOW /*TLPDF*/ +#ifdef TL_NOT_NOW /* TLPDF ??? */ // Formatieren und Ausdrucken pPrtShell->CalcLayout(); @@ -944,13 +944,13 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) BOOL ViewShell::Prt( OutputDevice* pOutDev, SwPrtOptions& rOptions, - SfxProgress* pProgress, + SfxProgress* pProgress, /* TLPDF superfluous ??? */ bool bIsPDFExport ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Immer die Druckroutine in viewpg.cxx (fuer Seitenvorschau) mitpflegen!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ASSERT( bIsPDFExport || pProgress, "Printing without progress bar!" ) +// TLPDF ASSERT( bIsPDFExport || pProgress, "Printing without progress bar!" ) BOOL bStartJob = FALSE; @@ -960,6 +960,7 @@ BOOL ViewShell::Prt( //! rOptions.bPrintSelection parameter will be false. BOOL bSelection = rOptions.bPrintSelection; +// TLPDF: this one should hold just one page now. Thus clean-up should be possible MultiSelection aMulti( rOptions.aMulti ); if ( !aMulti.GetSelectCount() ) @@ -974,6 +975,10 @@ BOOL ViewShell::Prt( ASSERT( aPages.Min() <= aPages.Max(), "MinSeite groesser MaxSeite." ); +// TLPDF + ASSERT( aPages.Min() == aPages.Max(), "Min page should be equal to Max page now" ); /* TL PDF */ +// TLPDF TODO: clean-up aPage.Min/Max which should be identical now + #ifdef TL_NOT_NOW /*TLPDF*/ Printer* pPrt = 0; //!! will be 0 for PDF export !! /*TLPDF*/ #endif // TL_NOT_NOW /*TLPDF*/ @@ -1101,13 +1106,14 @@ BOOL ViewShell::Prt( BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; - USHORT nCopyCnt = rOptions.bCollate ? rOptions.nCopyCount : 1; +// TLPDF USHORT nCopyCnt = rOptions.bCollate ? rOptions.nCopyCount : 1; - USHORT nPrintCount = 1; +// TLPDF USHORT nPrintCount = 1; XubString sJobName( rOptions.GetJobName() ); - for ( USHORT nCnt = 0; !bStop && nCnt < nCopyCnt; nCnt++ ) - { +// TLPDF the copy count is now handled by the printer itself... +// TLPDF for ( USHORT nCnt = 0; !bStop && nCnt < nCopyCnt; nCnt++ ) +// TLPDF { const SwPageFrm *pStPage = (SwPageFrm*)pShell->GetLayout()->Lower(); const SwFrm *pEndPage = pStPage; @@ -1126,8 +1132,9 @@ BOOL ViewShell::Prt( // Reschedule statt Yield, da Yield keine Events abarbeitet // und es sonst eine Endlosschleife gibt. - while( pOutDev->IsPrinting() && pProgress ) - pProgress->Reschedule(); +// TLPDF progrssbaris now handled by new print dialog +// TLPDF while( pOutDev->IsPrinting() && pProgress ) +// TLPDF pProgress->Reschedule(); sJobName = rOptions.MakeNextJobName(); nJobStartError = JOBSET_ERR_DEFAULT; @@ -1135,36 +1142,37 @@ BOOL ViewShell::Prt( } #endif //TL_NOT_NOW /*TLPDF*/ - for( USHORT i = 1; i <= (USHORT)aPages.Max(); ++i ) - { - if( i < (USHORT)aPages.Min() ) - { - if( !pStPage->GetNext() ) - break; - pStPage = (SwPageFrm*)pStPage->GetNext(); - pEndPage= pStPage; - } - else if( i == (USHORT)aPages.Min() ) - { - nFirstPageNo = i; - nLastPageNo = nFirstPageNo; - if( !pStPage->GetNext() || (i == (USHORT)aPages.Max()) ) - break; - pEndPage = pStPage->GetNext(); - } - else if( i > (USHORT)aPages.Min() ) - { - nLastPageNo = i; - if( !pEndPage->GetNext() || (i == (USHORT)aPages.Max()) ) - break; - pEndPage = pEndPage->GetNext(); - } - } - + for( USHORT i = 1; i <= (USHORT)aPages.Max(); ++i ) + { + if( i < (USHORT)aPages.Min() ) + { + if( !pStPage->GetNext() ) + break; + pStPage = (SwPageFrm*)pStPage->GetNext(); + pEndPage= pStPage; + } + else if( i == (USHORT)aPages.Min() ) + { + nFirstPageNo = i; + nLastPageNo = nFirstPageNo; + if( !pStPage->GetNext() || (i == (USHORT)aPages.Max()) ) + break; + pEndPage = pStPage->GetNext(); + } + else if( i > (USHORT)aPages.Min() ) + { + nLastPageNo = i; + if( !pEndPage->GetNext() || (i == (USHORT)aPages.Max()) ) + break; + pEndPage = pEndPage->GetNext(); + } + } + + OSL_ENSURE( nFirstPageNo, "fist page not found! Should not happen!" ); // TLPDF if( !nFirstPageNo ) { - bStop = TRUE; - break; +// TLPDF bStop = TRUE; +// TLPDF break; // TLPDF should continue after '(end of the copy count loop)' } // HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit @@ -1357,10 +1365,12 @@ BOOL ViewShell::Prt( rOptions.bPrintRightPage, rOptions.bPrintLeftPage, rOptions.bPrintReverse ); +#ifdef TL_NOT_NOW /*TLPDF*/ if ( pProgress ) lcl_SetState( *pProgress, nPrintCount++, nSelCount, pStr, nMergeAct, nMergeCnt, nSelCount, nPageNo ); +#endif // TL_NOT_NOW /*TLPDF*/ if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError && sJobName.Len() ) @@ -1438,28 +1448,34 @@ BOOL ViewShell::Prt( { ++nPageNo; pStPage = (SwPageFrm*)pStPage->GetNext(); } - } - if ( bStop ) - break; + } // TLPDF loop end: while( pStPage && !bStop ) +// TLPDF if ( bStop ) +// TLPDF break; } - // Wenn PostIts am Dokumentenende gedruckt werden sollen, dann hier machen - if( ((rOptions.nPrintPostIts == POSTITS_ENDDOC) && !rOptions.bPrintReverse) - || (rOptions.nPrintPostIts == POSTITS_ONLY) ) - lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, - sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); - - if( pPostItShell ) + if (!bStop) // TLPDF: see break above { - pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt - delete pPostItShell; //Nimmt das PostItDoc mit ins Grab. - } + // Wenn PostIts am Dokumentenende gedruckt werden sollen, dann hier machen + if( ((rOptions.nPrintPostIts == POSTITS_ENDDOC) && !rOptions.bPrintReverse) + || (rOptions.nPrintPostIts == POSTITS_ONLY) ) + lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, + sJobName, bStartJob, nJobStartError, + rOptions.bPrintRightPage, rOptions.bPrintLeftPage, + rOptions.bPrintReverse ); + + if( pPostItShell ) + { + pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt + delete pPostItShell; //Nimmt das PostItDoc mit ins Grab. + } - if( bStartJob ) - rOptions.bJobStartet = TRUE; - } + if( bStartJob ) + rOptions.bJobStartet = TRUE; + } // TLPDF: if (!bStop) see break above + +// TLPDF the copy count is now handled by the printer itself... +// TLPDF (end of the copy count loop) +// TLPDF } } delete pStr; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index a71f1f9f8a27..acb13e3681b4 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -133,6 +133,7 @@ #include #include #include +#include #include #include @@ -2935,6 +2936,141 @@ SfxViewShell * SwXTextDocument::GuessViewShell() /* -----------------------------23.08.02 16:00-------------------------------- ---------------------------------------------------------------------------*/ + +static bool lcl_getSingleValue( + const OUString &rText, + sal_Int32 &rVal ) +{ + bool bRes = false; + const sal_Int32 nLen = rText.getLength(); + if (nLen > 0) + { + // verify that text consists of decimal number 0..9 only + bool bValidText = true; + const sal_Unicode *pText = rText.getStr(); + for (sal_Int32 i = 0; i < nLen && bValidText; ++i) + { + const sal_Unicode cChar = pText[i]; + if (cChar < '0' || cChar > '9') + bValidText = false; + } + + // get integer value if text is valid + if (bValidText) + { + rVal = rText.toInt32(); + bRes = true; + } + } + return bRes; +} + +static bool lcl_getSubRangeBounds( + const OUString &rSubRange, + sal_Int32 &rFirst, + sal_Int32 &rLast ) +{ + bool bRes = false; + + // check for page range... + sal_Int32 nPos = rSubRange.indexOf( (sal_Unicode)'-' ); + if (nPos > 0) + { + // page range found... + nPos = 0; + const OUString aFirstPage( rSubRange.getToken( 0, '-', nPos ) ); + const OUString aLastPage( rSubRange.getToken( 0, '-', nPos ) ); + sal_Int32 nTmpFirst = -1; + sal_Int32 nTmpLast = -1; + if (lcl_getSingleValue( aFirstPage, nTmpFirst ) && lcl_getSingleValue( aLastPage, nTmpLast )) + { + rFirst = nTmpFirst; + rLast = nTmpLast; + bRes = true; + } + } + else + { + // single page value... + sal_Int32 nVal = -1; + if (lcl_getSingleValue( rSubRange, nVal )) + { + rFirst = rLast = nVal; + bRes = true; + } + } + + return bRes; +} + +static bool lcl_PageRangeToVector( + const OUString &rPageRange, // valid format example "5-3,9,9,7-8" instead of ',' ';' or ' ' are allowed as well + std::vector< sal_Int32 > &rPageVector ) +{ + bool bRes = false; + + // - strip leading and trailing whitespaces + // - unify token delimeters to ';' + // - remove duplicate delimiters + OUString aRange( rPageRange.trim() ); + aRange = aRange.replace( (sal_Unicode)' ', (sal_Unicode)';' ); + aRange = aRange.replace( (sal_Unicode)',', (sal_Unicode)';' ); + sal_Int32 nPos = -1; + while ((nPos = aRange.indexOf( C2U(";;") )) >= 0) + aRange = aRange.replaceAt( nPos, 2, C2U(";") ); + + if (aRange.getLength() > 0) + { + std::vector< sal_Int32 > aTmpVector; + + // iterate over all sub ranges and add the respective pages to the + // vector while preserving the page order + bool bFailed = false; + nPos = 0; + do + { + const OUString aSubRange = aRange.getToken( 0, ';', nPos ); + sal_Int32 nFirst = -1, nLast = -1; + if (lcl_getSubRangeBounds( aSubRange, nFirst, nLast ) + && nFirst > 0 && nLast > 0) + { + // add pages of sub range to vector + if (nFirst == nLast) + aTmpVector.push_back( nFirst ); + else if (nFirst < nLast) + { + for (sal_Int32 i = nFirst; i <= nLast; ++i) + aTmpVector.push_back( i ); + } + else if (nFirst > nLast) + { + for (sal_Int32 i = nFirst; i >= nLast; --i) + aTmpVector.push_back( i ); + } + else + OSL_ENSURE( 0, "unexpected case" ); + } + else + bFailed = true; + } + while (!bFailed && 0 <= nPos && nPos < aRange.getLength()); + + if (!bFailed) + { + rPageVector = aTmpVector; + bRes = true; + } + } + else + { + // empty string ... + rPageVector.clear(); + bRes = true; + } + + return bRes; +} + void SAL_CALL SwXTextDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection, @@ -3015,6 +3151,16 @@ void SAL_CALL SwXTextDocument::render( rxOptions[ nProperty].Value >>= bSkipEmptyPages; } +#if OSL_DEBUG_LEVEL > 1 + std::vector< sal_Int32 > _aVec1; + bool _bTmp1 = lcl_PageRangeToVector( C2U(""), _aVec1 ); + _bTmp1 = lcl_PageRangeToVector( C2U("-1"), _aVec1 ); + _bTmp1 = lcl_PageRangeToVector( C2U("3 0"), _aVec1 ); + _bTmp1 = lcl_PageRangeToVector( C2U("1-5,7 7,15-12;8"), _aVec1 ); + _bTmp1 = lcl_PageRangeToVector( C2U(" 2-6,,7 7,15-12;;;9"), _aVec1 ); + _bTmp1 = lcl_PageRangeToVector( C2U(";,5-1,,7 7,12-15;;;9"), _aVec1 ); +#endif + OutputDevice* pOut = 0; if (xRenderDevice.is()) { -- cgit v1.2.3 From 3c7537520ff5fb728e357a6f6cb7b1a343cd54fe Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 16 Jul 2009 14:39:49 +0000 Subject: #i101242# new print UI dialog; PageRange now basically functional --- sw/inc/doc.hxx | 9 + sw/inc/swprtopt.hxx | 40 +++ sw/inc/viewsh.hxx | 6 +- sw/source/core/doc/doc.cxx | 130 +++++++++- sw/source/core/view/vprint.cxx | 566 +++++++++++++++++++---------------------- sw/source/ui/dbui/dbmgr.cxx | 8 + sw/source/ui/uiview/pview.cxx | 4 + sw/source/ui/uno/unotxdoc.cxx | 407 ++++------------------------- 8 files changed, 502 insertions(+), 668 deletions(-) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a82ea0235359..87252e9119ee 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -113,6 +113,8 @@ class SwList; #include #include +#include +#include #include @@ -239,6 +241,8 @@ class SwMsgPoolItem; class SwChartDataProvider; class SwChartLockController_Helper; class IGrammarContact; +class SwPrintUIOptions; +class SwPageFrm; namespace sw { namespace mark { class MarkManager; @@ -1350,6 +1354,11 @@ public: sal_Bool InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, SwPaM& rPaM, SwCrsrShell* pShell = 0); + // get the set of printable pages for the XRenderable API by + // evaluating the respective settings (see implementation) + void GetValidPagesForPrinting( SwPrintUIOptions &rPrintUIOptions, + sal_Int32 nDocPageCount ); + sal_uInt16 GetPageCount() const; const Size GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const; diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index 38250fe7f28d..d2b45b37d234 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -31,14 +31,24 @@ #ifndef _SWPRTOPT_HXX #define _SWPRTOPT_HXX +#include #include #include +#include +#include +#include + #define POSTITS_NONE 0 #define POSTITS_ONLY 1 #define POSTITS_ENDDOC 2 #define POSTITS_ENDPAGE 3 + +class SwPageFrm; + +//////////////////////////////////////////////////////////// + class SwPrtOptions : public SwPrintData { USHORT nJobNo; @@ -83,6 +93,36 @@ public: }; +//////////////////////////////////////////////////////////// + +class SwPrintUIOptions : public vcl::PrinterOptionsHelper +{ + OutputDevice* mpLast; + + // pages valid for printing (accoridng to the current settings) + // and their respective start frames (see getRendererCount in unotxdoc.cxx) + std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) + std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages + + // vector of pages and their order to be printed (duplicates and any order allowed!) + // (see 'render' in unotxdoc.cxx) + std::vector< sal_Int32 > aPagesToPrint; + +public: + SwPrintUIOptions( BOOL bWeb ); + + bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + + typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; + + std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } + ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } + const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } + std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } + const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } +}; + + #endif //_SWPRTOPT_HXX diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 5a249db26337..dbbeec0e7d8e 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -71,6 +71,7 @@ class SfxViewShell; class SwViewOption; class SwViewImp; class SwPrtOptions; +class SwPrintUIOptions; class SwPagePreViewPrtData; class Window; class OutputDevice; @@ -364,8 +365,9 @@ public: //Druckauftrag abwickeln. // bIsPDFExport == true is: do PDF Export (no printing!) - sal_Bool Prt( OutputDevice* pOutDev, SwPrtOptions& rOptions, SfxProgress* pProgress, - bool bIsPDFExport = false ); + sal_Bool Prt( OutputDevice* pOutDev, SwPrtOptions& rOptions, + const SwPrintUIOptions &rPrintUIOptions, sal_Int32 nRenderer /* offset in vector of pages to print */, + SfxProgress* pProgress, bool bIsPDFExport = false ); //"Drucken" fuer OLE 2.0 static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index ae48966e31b8..2e92d8adb89b 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -95,12 +96,9 @@ #include #include #include -#ifndef _CMDID_H +#include #include // fuer den dflt - Printer in SetJob -#endif -#ifndef _STATSTR_HRC #include // StatLine-String -#endif #include #include #include @@ -991,6 +989,130 @@ const SwDocStat& SwDoc::GetDocStat() const return *pDocStat; } + +void SwDoc::GetValidPagesForPrinting( + SwPrintUIOptions &rPrintUIOptions, + sal_Int32 nDocPageCount ) +{ + DBG_ASSERT( pLayout, "no layout present" ); + if (!pLayout) + return; + + // properties to take into account when calcualting the set of pages + const bool bPrintLeftPage = rPrintUIOptions.getBoolValue( C2U( "PrintLeftPages" ), false ); + const bool bPrintRightPage = rPrintUIOptions.getBoolValue( C2U( "PrintRightPages" ), false ); + const bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + const bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); + + Range aPages( 1, nDocPageCount ); + + MultiSelection aMulti( aPages ); + aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); + aMulti.Select( aPages ); + + const SwPageFrm *pStPage = (SwPageFrm*)pLayout->Lower(); + const SwFrm *pEndPage = pStPage; + + USHORT nFirstPageNo = 0; + USHORT nLastPageNo = 0; + USHORT nPageNo = 1; + + for( USHORT i = 1; i <= (USHORT)aPages.Max(); ++i ) + { + if( i < (USHORT)aPages.Min() ) + { + if( !pStPage->GetNext() ) + break; + pStPage = (SwPageFrm*)pStPage->GetNext(); + pEndPage= pStPage; + } + else if( i == (USHORT)aPages.Min() ) + { + nFirstPageNo = i; + nLastPageNo = nFirstPageNo; + if( !pStPage->GetNext() || (i == (USHORT)aPages.Max()) ) + break; + pEndPage = pStPage->GetNext(); + } + else if( i > (USHORT)aPages.Min() ) + { + nLastPageNo = i; + if( !pEndPage->GetNext() || (i == (USHORT)aPages.Max()) ) + break; + pEndPage = pEndPage->GetNext(); + } + } + + DBG_ASSERT( nFirstPageNo, "first page not found! Should not happen!" ); + if (nFirstPageNo) + { +// HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit +// geschaffen werden, alle Seiten von Seite x an zu deselektieren. +// Z.B. durch SetTotalRange .... + +// aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), FALSE ); + MultiSelection aTmpMulti( Range( 1, nLastPageNo ) ); + long nTmpIdx = aMulti.FirstSelected(); + static long nEndOfSelection = SFX_ENDOFSELECTION; + while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nLastPageNo) ) + { + aTmpMulti.Select( nTmpIdx ); + nTmpIdx = aMulti.NextSelected(); + } + aMulti = aTmpMulti; +// Ende des HACKs + + if (bPrintReverse) + { + const SwFrm *pTmp = pStPage; + pStPage = (SwPageFrm*)pEndPage; + pEndPage = pTmp; + nPageNo = nLastPageNo; + } + else + nPageNo = nFirstPageNo; + + std::set< sal_Int32 > &rValidPages = rPrintUIOptions.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rPrintUIOptions.GetValidStartFrms(); + rValidPages.clear(); + rValidStartFrms.clear(); + while ( pStPage ) + { + const BOOL bRightPg = pStPage->OnRightPage(); + if ( aMulti.IsSelected( nPageNo ) && + ( (bRightPg && bPrintRightPage) || + (!bRightPg && bPrintLeftPage) ) ) + { + // --> FME 2005-12-12 #b6354161# Feature - Print empty pages + if ( bPrintEmptyPages || pStPage->Frm().Height() ) + // <-- + { + // pStPage->GetUpper()->Paint( pStPage->Frm() ); + rValidPages.insert( nPageNo ); + rValidStartFrms[ nPageNo ] = pStPage; + } + } + + if ( pStPage == pEndPage ) + { + pStPage = 0; + } + else if ( bPrintReverse ) + { + --nPageNo; + pStPage = (SwPageFrm*)pStPage->GetPrev(); + } + else + { ++nPageNo; + pStPage = (SwPageFrm*)pStPage->GetNext(); + } + } + } +} + + + + sal_uInt16 SwDoc::GetPageCount() const { return GetRootFrm() ? GetRootFrm()->GetPageNum() : 0; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 9d8fd79c139c..8e50ada89c58 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -32,13 +32,18 @@ #include "precompiled_sw.hxx" +#include +#include + #include #include #include +#include +#include +#include +#include +#include -#ifndef _INTN_HXX //autogen -// #include -#endif #include #include #include @@ -46,6 +51,7 @@ #include #include #include + #include #include #include @@ -76,11 +82,15 @@ #include // MinPrtLine #include // SwShellCrsr #include // SwFmtPageDesc +#include #define JOBSET_ERR_DEFAULT 0 #define JOBSET_ERR_ERROR 1 #define JOBSET_ERR_ISSTARTET 2 + +using namespace ::com::sun::star; + //-------------------------------------------------------------------- //Klasse zum Puffern von Paints class SwQueuedPaint @@ -201,6 +211,7 @@ void SwPaintQueue::Remove( ViewShell *pSh ) } } +/*****************************************************************************/ const XubString& SwPrtOptions::MakeNextJobName() { @@ -214,6 +225,205 @@ const XubString& SwPrtOptions::MakeNextJobName() return sJobName += XubString::CreateFromInt32( ++nJobNo ); } +/*****************************************************************************/ + +SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : + mpLast( NULL ) +{ + ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); + + DBG_ASSERT( aLocalizedStrings.Count() >= 46, "resource incomplete" ); + if( aLocalizedStrings.Count() < 46 ) // bad resource ? + return; + + // create sequence of print UI options + // (5 options are not available for Writer-Web) + const int nNumProps = bWeb? 17 : 22; + m_aUIProperties.realloc( nNumProps ); + int nIdx = 0; + + // create Section for Contents (results in an extra tab page in dialog) + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); + + // create a bool option for graphics + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), + aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), + sal_True ); + // create a bool option for tables + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), + sal_True ); + + if (!bWeb) + { + // create a bool option for drawings + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), + aLocalizedStrings.GetString( 6 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), + sal_True ); + } + + // create a bool option for controls + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), + aLocalizedStrings.GetString( 8 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), + sal_True ); + + // create a bool option for background + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), + aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), + sal_True ); + + // create a bool option for black + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), + aLocalizedStrings.GetString( 12 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), + sal_False ); + + if (!bWeb) + { + // create a bool option for hidden text + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), + aLocalizedStrings.GetString( 14 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), + sal_False ); + + // create a bool option for place holder + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), + aLocalizedStrings.GetString( 16 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), + sal_False ); + } + + // create a list box for notes content + uno::Sequence< rtl::OUString > aChoices( 4 ); + aChoices[0] = aLocalizedStrings.GetString( 19 ); + aChoices[1] = aLocalizedStrings.GetString( 20 ); + aChoices[2] = aLocalizedStrings.GetString( 21 ); + aChoices[3] = aLocalizedStrings.GetString( 22 ); + uno::Sequence< rtl::OUString > aHelpText( 2 ); + aHelpText[0] = aLocalizedStrings.GetString( 18 ); + aHelpText[1] = aLocalizedStrings.GetString( 18 ); + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), + aHelpText, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), + aChoices, + 0, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) + ); + + // create Section for Page settings (results in an extra tab page in dialog) + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); + + if (!bWeb) + { + // create a bool option for left pages + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 24 ), + aLocalizedStrings.GetString( 25 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), + sal_True ); + + // create a bool option for right pages + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 26 ), + aLocalizedStrings.GetString( 27 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), + sal_True ); + } + + // create a bool option for reversed order (solve in vcl ?) + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 28 ), + aLocalizedStrings.GetString( 29 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), + sal_False ); + + // create a bool option for brochure + rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), + aLocalizedStrings.GetString( 31 ), + aBrochurePropertyName, + sal_False ); + + // create a bool option for brochure RTL dependent on brochure + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), + aLocalizedStrings.GetString( 33 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), + sal_False, + &aBrochurePropertyName, + -1, + sal_True + ); + + // create subgroup for misc options + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 34 ) ), rtl::OUString() ); + + // create a bool option for blank pages + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), + aLocalizedStrings.GetString( 36 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + sal_True ); + + // create a bool option for paper tray + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), + aLocalizedStrings.GetString( 38 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), + sal_False ); + + // print range selection + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), rtl::OUString(), true, true ); + + // create a choice for the content to create + rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); + aChoices.realloc( 3 ); + aHelpText.realloc( 3 ); + aChoices[0] = aLocalizedStrings.GetString( 40 ); + aHelpText[0] = aLocalizedStrings.GetString( 41 ); + aChoices[1] = aLocalizedStrings.GetString( 42 ); + aHelpText[1] = aLocalizedStrings.GetString( 43 ); + aChoices[2] = aLocalizedStrings.GetString( 44 ); + aHelpText[2] = aLocalizedStrings.GetString( 45 ); + m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), + aHelpText, + aPrintRangeName, + aChoices, + 0 ); + // create a an Edit dependent on "Pages" selected + m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), + rtl::OUString(), + &aPrintRangeName, 1, sal_True + ); + + + DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); +} + + +bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) +{ + bool bChanged = processProperties( i_rNewProp ); + + uno::Reference< awt::XDevice > xRenderDevice; + uno::Any aVal( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); + aVal >>= xRenderDevice; + + OutputDevice* pOut = 0; + if (xRenderDevice.is()) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + pOut = pDevice ? pDevice->GetOutputDevice() : 0; + } + bChanged = bChanged || (pOut != mpLast); + if( pOut ) + mpLast = pOut; + + return bChanged; +} + + /****************************************************************************** * Methode : void SetSwVisArea( ViewShell *pSh, Point aPrtOffset, ... * Beschreibung: @@ -228,8 +438,12 @@ void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL bPDFExport ) pSh->Imp()->SetFirstVisPageInvalid(); Point aPt( rRect.Pos() ); - if (!bPDFExport) - aPt += pSh->aPrtOffst; + // calculate an offset for the rectangle of the n-th page to + // move the start point of the output operation to a position + // such that in the output device all pages will be painted + // at the same position +// TLPDF if (!bPDFExport) +// TLPDF aPt += pSh->aPrtOffst; aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y(); // TLPDF OutputDevice *pOut = bPDFExport ? @@ -428,13 +642,13 @@ void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, pPrn->EndPage(); pPage = bReverse ? pPage->GetPrev() : pPage->GetNext(); } - #else - (void)pPrtShell; - (void)rJobName; - (void)rStartJob; - (void)rJobStartError; - (void)bReverse; - #endif +#else +(void)pPrtShell; +(void)rJobName; +(void)rStartJob; +(void)rJobStartError; +(void)bReverse; +#endif } /****************************************************************************** @@ -543,7 +757,7 @@ void ViewShell::InitPrt( /*Printer *pPrt,*/ OutputDevice *pOutDev ) /* TLPDF */ OutputDevice *pTmpDev = pOutDev; // TLPDF pPDFOut ? pPDFOut : (OutputDevice *) pPrt; if ( pTmpDev ) { -// TLPDRF aPrtOffst = pPrt ? pPrt->GetPageOffset() : Point(); +// TLPDF aPrtOffst = pPrt ? pPrt->GetPageOffset() : Point(); aPrtOffst = Point(); aPrtOffst += pTmpDev->GetMapMode().GetOrigin(); @@ -944,16 +1158,16 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) BOOL ViewShell::Prt( OutputDevice* pOutDev, SwPrtOptions& rOptions, + const SwPrintUIOptions &rPrintUIOptions, /* TLPDF keep this or the above? */ + sal_Int32 nRenderer, SfxProgress* pProgress, /* TLPDF superfluous ??? */ bool bIsPDFExport ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Immer die Druckroutine in viewpg.cxx (fuer Seitenvorschau) mitpflegen!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// TLPDF ASSERT( bIsPDFExport || pProgress, "Printing without progress bar!" ) BOOL bStartJob = FALSE; - //! Note: Since for PDF export of (multi-)selection a temporary //! document is created that contains only the selects parts, //! and thus that document is to printed in whole the, @@ -966,6 +1180,10 @@ BOOL ViewShell::Prt( if ( !aMulti.GetSelectCount() ) return bStartJob; + // save settings of OutputDevice (should be done always now since the + // output device is now provided by a call from outside the Writer) + pOutDev->Push(); + Range aPages( aMulti.FirstSelected(), aMulti.LastSelected() ); if ( aPages.Max() > USHRT_MAX ) aPages.Max() = USHRT_MAX; @@ -976,32 +1194,12 @@ BOOL ViewShell::Prt( "MinSeite groesser MaxSeite." ); // TLPDF - ASSERT( aPages.Min() == aPages.Max(), "Min page should be equal to Max page now" ); /* TL PDF */ + ASSERT( aPages.Min() == aPages.Max(), "Min page should be equal to Max page now" ); /* TLPDF */ // TLPDF TODO: clean-up aPage.Min/Max which should be identical now -#ifdef TL_NOT_NOW /*TLPDF*/ - Printer* pPrt = 0; //!! will be 0 for PDF export !! /*TLPDF*/ -#endif // TL_NOT_NOW /*TLPDF*/ - if (bIsPDFExport) - pOutDev->Push(); - else - { -#ifdef TL_NOT_NOW /*TLPDF*/ -// pOutDev = dynamic_cast< Printer* >(pOutDev); - DBG_ASSERT( pOutDev, "printer missing" ); - if( !pOutDev || !pOutDev->GetName().Len() ) - { - ASSERT( FALSE, "Drucken ohne Drucker?" ); - return bStartJob; - } - - if( !rOptions.GetJobName().Len() && !pOutDev->IsJobActive() ) - return bStartJob; -#endif // TL_NOT_NOW /*TLPDF*/ - } // Einstellungen am Drucker merken -// SwPrtOptSave aPrtSave( pOutDev ); /*TLPDF ???*/ +// SwPrtOptSave aPrtSave( pOutDev ); /* TLPDF wo dann heutzutage ??? */ // eine neue Shell fuer den Printer erzeugen ViewShell *pShell; @@ -1046,14 +1244,6 @@ BOOL ViewShell::Prt( SET_CURR_SHELL( pShell ); -#ifdef TL_NOT_NOW /*TLPDF*/ - if ( pProgress ) - { - Link aLnk = LINK(pShell->Imp(), SwViewImp, SetStopOutDev); - ((SfxPrintProgress *)pProgress)->SetCancelHdl(aLnk); - } -#endif // TL_NOT_NOW /*TLPDF*/ - //JP 01.02.99: das ReadOnly Flag wird NIE mitkopiert; Bug 61335 if( pOpt->IsReadonly() ) pShell->pOpt->SetReadonly( TRUE ); @@ -1065,27 +1255,27 @@ BOOL ViewShell::Prt( XubString* pStr = 0; ULONG nMergeAct = rOptions.nMergeAct, nMergeCnt = rOptions.nMergeCnt; - if ( pProgress ) - { - if( nMergeAct ) - { - pStr = new SW_RESSTR(STR_STATSTR_LETTER); - *pStr += ' '; - *pStr += XubString::CreateFromInt64( nMergeAct ); - if( nMergeCnt ) - { - *pStr += '/'; - *pStr += XubString::CreateFromInt64( nMergeCnt ); - } - } - else - { - ++nMergeAct; - } - } - // Seiten fuers Drucken formatieren - pShell->CalcPagesForPrint( (USHORT)aPages.Max(), pProgress, pStr, + +/* TLPDF neu: start */ +#if OSL_DEBUG_LEVEL > 1 + DBG_ASSERT( 0 <= nRenderer && nRenderer <= rPrintUIOptions.GetPagesToPrint().size(), + "nRenderer out of bounds"); +#endif + const sal_Int32 nPage = rPrintUIOptions.GetPagesToPrint()[ nRenderer ]; /* TLPDF */ +#if OSL_DEBUG_LEVEL > 1 + DBG_ASSERT( 0 <= nPage && nPage <= rPrintUIOptions.GetValidStartFrms().size(), + "nPage out of bounds"); +#endif + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); + SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + const SwPageFrm *pStPage = aIt->second; +/* TLPDF neu: end */ + + + // benötigte Seiten fuers Drucken formatieren + pShell->CalcPagesForPrint( (USHORT)nPage, pProgress, pStr, nMergeAct, nMergeCnt ); // Some field types, can require a valid layout @@ -1106,84 +1296,19 @@ BOOL ViewShell::Prt( BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; -// TLPDF USHORT nCopyCnt = rOptions.bCollate ? rOptions.nCopyCount : 1; - -// TLPDF USHORT nPrintCount = 1; XubString sJobName( rOptions.GetJobName() ); -// TLPDF the copy count is now handled by the printer itself... -// TLPDF for ( USHORT nCnt = 0; !bStop && nCnt < nCopyCnt; nCnt++ ) -// TLPDF { - const SwPageFrm *pStPage = (SwPageFrm*)pShell->GetLayout()->Lower(); - const SwFrm *pEndPage = pStPage; - - USHORT nFirstPageNo = 0; - USHORT nLastPageNo = 0; - USHORT nPageNo = 1; -#ifdef TL_NOT_NOW /*TLPDF*/ - if (pOutDev) - { - if( rOptions.IsPrintSingleJobs() && sJobName.Len() && - ( bStartJob || rOptions.bJobStartet ) ) - { - pOutDev->EndJob(); - bStartJob = FALSE; - rOptions.bJobStartet = TRUE; - - // Reschedule statt Yield, da Yield keine Events abarbeitet - // und es sonst eine Endlosschleife gibt. -// TLPDF progrssbaris now handled by new print dialog -// TLPDF while( pOutDev->IsPrinting() && pProgress ) -// TLPDF pProgress->Reschedule(); - - sJobName = rOptions.MakeNextJobName(); - nJobStartError = JOBSET_ERR_DEFAULT; - } - } -#endif //TL_NOT_NOW /*TLPDF*/ - - for( USHORT i = 1; i <= (USHORT)aPages.Max(); ++i ) - { - if( i < (USHORT)aPages.Min() ) - { - if( !pStPage->GetNext() ) - break; - pStPage = (SwPageFrm*)pStPage->GetNext(); - pEndPage= pStPage; - } - else if( i == (USHORT)aPages.Min() ) - { - nFirstPageNo = i; - nLastPageNo = nFirstPageNo; - if( !pStPage->GetNext() || (i == (USHORT)aPages.Max()) ) - break; - pEndPage = pStPage->GetNext(); - } - else if( i > (USHORT)aPages.Min() ) - { - nLastPageNo = i; - if( !pEndPage->GetNext() || (i == (USHORT)aPages.Max()) ) - break; - pEndPage = pEndPage->GetNext(); - } - } - - OSL_ENSURE( nFirstPageNo, "fist page not found! Should not happen!" ); // TLPDF - if( !nFirstPageNo ) - { -// TLPDF bStop = TRUE; -// TLPDF break; // TLPDF should continue after '(end of the copy count loop)' - } - // HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit // geschaffen werden, alle Seiten von Seite x an zu deselektieren. // Z.B. durch SetTotalRange .... // aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), FALSE ); - MultiSelection aTmpMulti( Range( 1, nLastPageNo ) ); +// TLPDF MultiSelection aTmpMulti( Range( 1, nLastPageNo ) ); + MultiSelection aTmpMulti( Range( 1, nPage ) ); long nTmpIdx = aMulti.FirstSelected(); static long nEndOfSelection = SFX_ENDOFSELECTION; - while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nLastPageNo) ) +// TLPDF while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nLastPageNo) ) + while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nPage) ) { aTmpMulti.Select( nTmpIdx ); nTmpIdx = aMulti.NextSelected(); @@ -1194,23 +1319,6 @@ BOOL ViewShell::Prt( const USHORT nSelCount = USHORT(aMulti.GetSelectCount() /* * nCopyCnt*/); - if ( pProgress ) - { - pProgress->SetText( SW_RESSTR(STR_STATSTR_PRINT) ); - lcl_SetState( *pProgress, 1, nSelCount, pStr, - nMergeAct, nMergeCnt, nSelCount, 1 ); - } - - if ( rOptions.bPrintReverse ) - { - const SwFrm *pTmp = pStPage; - pStPage = (SwPageFrm*)pEndPage; - pEndPage = pTmp; - nPageNo = nLastPageNo; - } - else - nPageNo = nFirstPageNo; - // PostitListe holen _SetGetExpFlds aPostItFields; SwDoc* pPostItDoc = 0; @@ -1241,51 +1349,12 @@ BOOL ViewShell::Prt( const SwPageDesc *pLastPageDesc = NULL; BOOL bSetOrient = FALSE; BOOL bSetPaperSz = FALSE; -#ifdef TL_NOT_NOW /*TLPDF*/ - BOOL bSetPaperBin = FALSE; -#endif // TL_NOT_NOW /*TLPDF*/ BOOL bSetPrt = FALSE; - if (pOutDev) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - bSetOrient = pOutDev->HasSupport( SUPPORT_SET_ORIENTATION ); - bSetPaperSz = pOutDev->HasSupport( SUPPORT_SET_PAPERSIZE ); - bSetPaperBin = !rOptions.bPaperFromSetup && - pOutDev->HasSupport( SUPPORT_SET_PAPERBIN ); - bSetPrt = bSetOrient || bSetPaperSz || bSetPaperBin; -#endif // TL_NOT_NOW /*TLPDF*/ - } if ( rOptions.nPrintPostIts != POSTITS_ONLY ) { - // --> FME 2005-01-05 #110536# This valiable is used to track - // the number of pages which actually have been printed. - // If nPagesPrinted is odd, we have to send an additional - // empty page to the printer if we are currently in collation - // and duplex mode and there are still some more copies of the - // document to print. - USHORT nPagesPrinted = 0; - // <-- - - while( pStPage && !bStop ) +//TLPDF while( pStPage && !bStop ) { - // Mag der Anwender noch ? - if ( pProgress ) - pProgress->Reschedule(); - -#ifdef TL_NOT_NOW /*TLPDF*/ - if (pOutDev) - { - if ( JOBSET_ERR_ERROR == nJobStartError || - ( !pOutDev->IsJobActive() && ( !sJobName.Len() || bStartJob ) ) || - pShell->Imp()->IsStopOutDev() ) - { - bStop = TRUE; - break; - } - } -#endif // TL_NOT_NOW /*TLPDF*/ - ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // wenn wir einen Umschlag drucken wird ein Offset beachtet @@ -1299,10 +1368,6 @@ BOOL ViewShell::Prt( pOutDev->SetMapMode( aTmp ); } - const BOOL bRightPg = pStPage->OnRightPage(); - if( aMulti.IsSelected( nPageNo ) && - ( (bRightPg && rOptions.bPrintRightPage) || - (!bRightPg && rOptions.bPrintLeftPage) ) ) { if ( bSetPrt ) { @@ -1312,47 +1377,6 @@ BOOL ViewShell::Prt( if ( pLastPageDesc != rFormatPage.GetPageDesc() ) { pLastPageDesc = rFormatPage.GetPageDesc(); - -#ifdef TL_NOT_NOW /*TLPDF*/ - const BOOL bLandScp = rFormatPage.GetPageDesc()->GetLandscape(); - - if( bSetPaperBin ) // Schacht einstellen. - pOutDev->SetPaperBin( rFormatPage.GetFmt()-> - GetPaperBin().GetValue() ); -#endif // TL_NOT_NOW /*TLPDF*/ - - if (bSetOrient ) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - // Orientation einstellen: Breiter als Hoch - // -> Landscape, sonst -> Portrait. - if( bLandScp ) - pOutDev->SetOrientation(ORIENTATION_LANDSCAPE); - else - pOutDev->SetOrientation(ORIENTATION_PORTRAIT); -#endif // TL_NOT_NOW /*TLPDF*/ - } - - if (bSetPaperSz ) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - Size aSize = pStPage->Frm().SSize(); - if ( bLandScp && bSetOrient ) - { - // landscape is always interpreted as a rotation by 90 degrees ! - // this leads to non WYSIWIG but at least it prints! - // #i21775# - long nWidth = aSize.Width(); - aSize.Width() = aSize.Height(); - aSize.Height() = nWidth; - } - Paper ePaper = SvxPaperInfo::GetSvPaper(aSize,MAP_TWIP,TRUE); - if ( PAPER_USER == ePaper ) - pOutDev->SetPaperSizeUser( aSize ); - else - pOutDev->SetPaper( ePaper ); -#endif // TL_NOT_NOW /*TLPDF*/ - } } } @@ -1361,50 +1385,26 @@ BOOL ViewShell::Prt( if( rOptions.bPrintReverse && rOptions.nPrintPostIts == POSTITS_ENDPAGE ) lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, - nPageNo, aMulti, sJobName, bStartJob, nJobStartError, + nPage /* TLPDF nPageNo*/, aMulti, sJobName, bStartJob, nJobStartError, rOptions.bPrintRightPage, rOptions.bPrintLeftPage, rOptions.bPrintReverse ); -#ifdef TL_NOT_NOW /*TLPDF*/ - if ( pProgress ) - lcl_SetState( *pProgress, nPrintCount++, nSelCount, - pStr, nMergeAct, nMergeCnt, - nSelCount, nPageNo ); -#endif // TL_NOT_NOW /*TLPDF*/ if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError && sJobName.Len() ) { -#ifdef TL_NOT_NOW /*TLPDF*/ - if( pOutDev && !pOutDev->IsJobActive() ) - { - bStartJob = pOutDev->StartJob( sJobName ); - if( !bStartJob ) - { - nJobStartError = JOBSET_ERR_ERROR; - continue; - } - } -#endif // TL_NOT_NOW /*TLPDF*/ // TLPDF pShell->InitPrt( pOutDev, bIsPDFExport ? pOutDev : 0 ); pShell->InitPrt( pOutDev ); - ::SetSwVisArea( pShell, pStPage->Frm(), TRUE /*bIsPDFExport*/ ); // TLPDF + ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages - if ( rOptions.bPrintEmptyPages || pStPage->Frm().Height() ) +// TLPDF if ( rOptions.bPrintEmptyPages || pStPage->Frm().Height() ) // <-- { -// TLPDF if (pOutDev) -// TLPDF pOutDev->StartPage(); - pStPage->GetUpper()->Paint( pStPage->Frm() ); - ++nPagesPrinted; - -// TLPDF if (pOutDev) -// TLPDF pOutDev->EndPage(); } SwPaintQueue::Repaint(); @@ -1412,7 +1412,7 @@ BOOL ViewShell::Prt( if( (!rOptions.bPrintReverse) && rOptions.nPrintPostIts == POSTITS_ENDPAGE ) lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, - nPageNo, aMulti, sJobName, bStartJob, nJobStartError, + nPage /* TLPDF nPageNo */, aMulti, sJobName, bStartJob, nJobStartError, rOptions.bPrintRightPage, rOptions.bPrintLeftPage, rOptions.bPrintReverse ); } @@ -1422,35 +1422,7 @@ BOOL ViewShell::Prt( if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) pOutDev->SetMapMode( aOldMapMode ); - if ( pStPage == pEndPage ) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - // --> FME 2005-01-05 #110536# Print emtpy page if - // we are have an odd page count in collation/duplex - // mode and there are still some copies to print: - if ( pPrt && ( 1 == ( nPagesPrinted % 2 ) ) && - ( DUPLEX_SHORTEDGE == pPrt->GetDuplexMode() || DUPLEX_LONGEDGE == pPrt->GetDuplexMode() ) && - nCnt + 1 < nCopyCnt ) - { - pOutDev->StartPage(); - pOutDev->EndPage(); - } - // <-- -#endif // TL_NOT_NOW /*TLPDF*/ - pStPage = 0; - } - else if ( rOptions.bPrintReverse ) - { - --nPageNo; - pStPage = (SwPageFrm*)pStPage->GetPrev(); - } - else - { ++nPageNo; - pStPage = (SwPageFrm*)pStPage->GetNext(); - } } // TLPDF loop end: while( pStPage && !bStop ) -// TLPDF if ( bStop ) -// TLPDF break; } if (!bStop) // TLPDF: see break above @@ -1473,10 +1445,6 @@ BOOL ViewShell::Prt( rOptions.bJobStartet = TRUE; } // TLPDF: if (!bStop) see break above -// TLPDF the copy count is now handled by the printer itself... -// TLPDF (end of the copy count loop) -// TLPDF } - } delete pStr; @@ -1493,9 +1461,9 @@ BOOL ViewShell::Prt( delete pOutDevDoc; } - // restore settings of OutputDevice - if (bIsPDFExport) - pOutDev->Pop(); + // restore settings of OutputDevice (should be done always now since the + // output device is now provided by a call from outside the Writer) + pOutDev->Pop(); return bStartJob; } diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 0f7c203195be..7fa9a24338c2 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -881,6 +881,8 @@ SwNewDBMgr::~SwNewDBMgr() BOOL SwNewDBMgr::MergePrint( SwView& rView, SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) { + (void) rView; (void) rOpt; (void) rProgress; (void) bIsAPI; /* TLPDF */ +#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section BOOL bSynchronizedDoc = pSh->IsLabelDoc() && pSh->GetSectionFmtCount() > 1; @@ -1038,6 +1040,8 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, } return bRet; +#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + return TRUE; /* TLPDF */ } /*-- 21.06.2004 09:08:16--------------------------------------------------- @@ -1045,6 +1049,8 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) { + (void) rView; (void) rOpt; (void) rProgress; (void) bIsAPI; /* TLPDF */ +#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section //merge source is already open @@ -1201,6 +1207,8 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, } return bRet; +#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + return TRUE; /* TLPDF */ } diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index a9b36d255a23..263068d03a42 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -2470,7 +2470,11 @@ USHORT SwPagePreView::Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog * if( bPrtPros ) pSh->PrintProspect( aOpts, rProgress, bPrtPros_RTL ); else + { +#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer pSh->Prt( pPrinter, aOpts, &rProgress ); /*TLPDF*/ +#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + } } else { diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index acb13e3681b4..097dbfa7bf96 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -31,8 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include -#include +#include #include #include #include @@ -40,6 +39,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -56,7 +58,6 @@ #include #include #include -#include #include #include #include // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell) @@ -171,210 +172,6 @@ using ::osl::FileBase; * ******************************************************************************/ -class SwPrintUIOptions : public vcl::PrinterOptionsHelper -{ - OutputDevice* mpLast; -public: - SwPrintUIOptions( BOOL bWeb ); - - bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); - -}; - -SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : - mpLast( NULL ) -{ - ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - - DBG_ASSERT( aLocalizedStrings.Count() >= 46, "resource incomplete" ); - if( aLocalizedStrings.Count() < 46 ) // bad resource ? - return; - - // create sequence of print UI options - // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 17 : 22; - m_aUIProperties.realloc( nNumProps ); - int nIdx = 0; - - // create Section for Contents (results in an extra tab page in dialog) - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); - - // create a bool option for graphics - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), - aLocalizedStrings.GetString( 2 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), - sal_True ); - // create a bool option for tables - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), - aLocalizedStrings.GetString( 4 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), - sal_True ); - - if (!bWeb) - { - // create a bool option for drawings - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), - aLocalizedStrings.GetString( 6 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), - sal_True ); - } - - // create a bool option for controls - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), - aLocalizedStrings.GetString( 8 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), - sal_True ); - - // create a bool option for background - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), - aLocalizedStrings.GetString( 10 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), - sal_True ); - - // create a bool option for black - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), - aLocalizedStrings.GetString( 12 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), - sal_False ); - - if (!bWeb) - { - // create a bool option for hidden text - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), - aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), - sal_False ); - - // create a bool option for place holder - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), - aLocalizedStrings.GetString( 16 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), - sal_False ); - } - - // create a list box for notes content - Sequence< rtl::OUString > aChoices( 4 ); - aChoices[0] = aLocalizedStrings.GetString( 19 ); - aChoices[1] = aLocalizedStrings.GetString( 20 ); - aChoices[2] = aLocalizedStrings.GetString( 21 ); - aChoices[3] = aLocalizedStrings.GetString( 22 ); - Sequence< rtl::OUString > aHelpText( 2 ); - aHelpText[0] = aLocalizedStrings.GetString( 18 ); - aHelpText[1] = aLocalizedStrings.GetString( 18 ); - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), - aHelpText, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), - aChoices, - 0, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) - ); - - // create Section for Page settings (results in an extra tab page in dialog) - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); - - if (!bWeb) - { - // create a bool option for left pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 24 ), - aLocalizedStrings.GetString( 25 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), - sal_True ); - - // create a bool option for right pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 26 ), - aLocalizedStrings.GetString( 27 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), - sal_True ); - } - - // create a bool option for reversed order (solve in vcl ?) - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 28 ), - aLocalizedStrings.GetString( 29 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), - sal_False ); - - // create a bool option for brochure - OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), - aLocalizedStrings.GetString( 31 ), - aBrochurePropertyName, - sal_False ); - - // create a bool option for brochure RTL dependent on brochure - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), - aLocalizedStrings.GetString( 33 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), - sal_False, - &aBrochurePropertyName, - -1, - sal_True - ); - - // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 34 ) ), rtl::OUString() ); - - // create a bool option for blank pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), - aLocalizedStrings.GetString( 36 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - sal_True ); - - // create a bool option for paper tray - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), - aLocalizedStrings.GetString( 38 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), - sal_False ); - - // print range selection - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), rtl::OUString(), true, true ); - - // create a choice for the content to create - rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); - aChoices.realloc( 3 ); - aHelpText.realloc( 3 ); - aChoices[0] = aLocalizedStrings.GetString( 40 ); - aHelpText[0] = aLocalizedStrings.GetString( 41 ); - aChoices[1] = aLocalizedStrings.GetString( 42 ); - aHelpText[1] = aLocalizedStrings.GetString( 43 ); - aChoices[2] = aLocalizedStrings.GetString( 44 ); - aHelpText[2] = aLocalizedStrings.GetString( 45 ); - m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), - aHelpText, - aPrintRangeName, - aChoices, - 0 ); - // create a an Edit dependent on "Pages" selected - m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), - rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), - rtl::OUString(), - &aPrintRangeName, 1, sal_True - ); - - - DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); -} - -bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) -{ - bool bChanged = processProperties( i_rNewProp ); - - uno::Reference< awt::XDevice > xRenderDevice; - Any aVal( getValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); - aVal >>= xRenderDevice; - - OutputDevice* pOut = 0; - if (xRenderDevice.is()) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - pOut = pDevice ? pDevice->GetOutputDevice() : 0; - } - bChanged = bChanged || (pOut != mpLast); - if( pOut ) - mpLast = pOut; - - return bChanged; -} SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc) { @@ -2758,7 +2555,6 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rSelection, bool bIsPDFExport ) { - (void) bIsPDFExport; SwDoc *pDoc = 0; uno::Reference< frame::XModel > xModel; @@ -2798,6 +2594,7 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS } return pDoc; } + /* -----------------------------23.08.02 16:00-------------------------------- ---------------------------------------------------------------------------*/ @@ -2844,18 +2641,43 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( SwViewOptionAdjust_Impl aAdjust(*pWrtShell); if( bFormat ) { - if (bIsPDFExport) - pWrtShell->SetPDFExportOption( sal_True ); + // since printing now also use the API for PDF export this option + // should be set for printing as well ... + pWrtShell->SetPDFExportOption( sal_True ); // --> FME 2005-05-23 #122919# Force field update before PDF export: pWrtShell->ViewShell::UpdateFlds(TRUE); // <-- pWrtShell->CalcLayout(); - if (bIsPDFExport) - pWrtShell->SetPDFExportOption( sal_False ); + pWrtShell->SetPDFExportOption( sal_False ); + } + + const sal_Int32 nPageCount = pDoc->GetPageCount(); + if (bIsPDFExport) + nRet = nPageCount; + else + { + OUString aPageRange = m_pPrintUIOptions->getStringValue( C2U( "PageRange" ), OUString() ); + if (aPageRange.getLength() == 0) + { + // set page range to print all pages + aPageRange = OUString::valueOf( (sal_Int32)1 ); + aPageRange += OUString::valueOf( (sal_Unicode)'-'); + aPageRange += OUString::valueOf( nPageCount ); + } + + // get set of valid pages (according to the current settings) + // and their start frames + pDoc->GetValidPagesForPrinting( *m_pPrintUIOptions, nPageCount ); + + // get vector of pages to print according to PageRange and valid pages from above + StringRangeEnumerator::getRangesFromString( + aPageRange, m_pPrintUIOptions->GetPagesToPrint(), + 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + + nRet = m_pPrintUIOptions->GetPagesToPrint().size(); } - nRet = pDoc->GetPageCount(); return nRet; } @@ -2937,140 +2759,6 @@ SfxViewShell * SwXTextDocument::GuessViewShell() ---------------------------------------------------------------------------*/ -static bool lcl_getSingleValue( - const OUString &rText, - sal_Int32 &rVal ) -{ - bool bRes = false; - const sal_Int32 nLen = rText.getLength(); - if (nLen > 0) - { - // verify that text consists of decimal number 0..9 only - bool bValidText = true; - const sal_Unicode *pText = rText.getStr(); - for (sal_Int32 i = 0; i < nLen && bValidText; ++i) - { - const sal_Unicode cChar = pText[i]; - if (cChar < '0' || cChar > '9') - bValidText = false; - } - - // get integer value if text is valid - if (bValidText) - { - rVal = rText.toInt32(); - bRes = true; - } - } - return bRes; -} - -static bool lcl_getSubRangeBounds( - const OUString &rSubRange, - sal_Int32 &rFirst, - sal_Int32 &rLast ) -{ - bool bRes = false; - - // check for page range... - sal_Int32 nPos = rSubRange.indexOf( (sal_Unicode)'-' ); - if (nPos > 0) - { - // page range found... - nPos = 0; - const OUString aFirstPage( rSubRange.getToken( 0, '-', nPos ) ); - const OUString aLastPage( rSubRange.getToken( 0, '-', nPos ) ); - sal_Int32 nTmpFirst = -1; - sal_Int32 nTmpLast = -1; - if (lcl_getSingleValue( aFirstPage, nTmpFirst ) && lcl_getSingleValue( aLastPage, nTmpLast )) - { - rFirst = nTmpFirst; - rLast = nTmpLast; - bRes = true; - } - } - else - { - // single page value... - sal_Int32 nVal = -1; - if (lcl_getSingleValue( rSubRange, nVal )) - { - rFirst = rLast = nVal; - bRes = true; - } - } - - return bRes; -} - -static bool lcl_PageRangeToVector( - const OUString &rPageRange, // valid format example "5-3,9,9,7-8" instead of ',' ';' or ' ' are allowed as well - std::vector< sal_Int32 > &rPageVector ) -{ - bool bRes = false; - - // - strip leading and trailing whitespaces - // - unify token delimeters to ';' - // - remove duplicate delimiters - OUString aRange( rPageRange.trim() ); - aRange = aRange.replace( (sal_Unicode)' ', (sal_Unicode)';' ); - aRange = aRange.replace( (sal_Unicode)',', (sal_Unicode)';' ); - sal_Int32 nPos = -1; - while ((nPos = aRange.indexOf( C2U(";;") )) >= 0) - aRange = aRange.replaceAt( nPos, 2, C2U(";") ); - - if (aRange.getLength() > 0) - { - std::vector< sal_Int32 > aTmpVector; - - // iterate over all sub ranges and add the respective pages to the - // vector while preserving the page order - bool bFailed = false; - nPos = 0; - do - { - const OUString aSubRange = aRange.getToken( 0, ';', nPos ); - sal_Int32 nFirst = -1, nLast = -1; - if (lcl_getSubRangeBounds( aSubRange, nFirst, nLast ) - && nFirst > 0 && nLast > 0) - { - // add pages of sub range to vector - if (nFirst == nLast) - aTmpVector.push_back( nFirst ); - else if (nFirst < nLast) - { - for (sal_Int32 i = nFirst; i <= nLast; ++i) - aTmpVector.push_back( i ); - } - else if (nFirst > nLast) - { - for (sal_Int32 i = nFirst; i >= nLast; --i) - aTmpVector.push_back( i ); - } - else - OSL_ENSURE( 0, "unexpected case" ); - } - else - bFailed = true; - } - while (!bFailed && 0 <= nPos && nPos < aRange.getLength()); - - if (!bFailed) - { - rPageVector = aTmpVector; - bRes = true; - } - } - else - { - // empty string ... - rPageVector.clear(); - bRes = true; - } - - return bRes; -} - void SAL_CALL SwXTextDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection, @@ -3151,16 +2839,6 @@ void SAL_CALL SwXTextDocument::render( rxOptions[ nProperty].Value >>= bSkipEmptyPages; } -#if OSL_DEBUG_LEVEL > 1 - std::vector< sal_Int32 > _aVec1; - bool _bTmp1 = lcl_PageRangeToVector( C2U(""), _aVec1 ); - _bTmp1 = lcl_PageRangeToVector( C2U("-1"), _aVec1 ); - _bTmp1 = lcl_PageRangeToVector( C2U("3 0"), _aVec1 ); - _bTmp1 = lcl_PageRangeToVector( C2U("1-5,7 7,15-12;8"), _aVec1 ); - _bTmp1 = lcl_PageRangeToVector( C2U(" 2-6,,7 7,15-12;;;9"), _aVec1 ); - _bTmp1 = lcl_PageRangeToVector( C2U(";,5-1,,7 7,12-15;;;9"), _aVec1 ); -#endif - OutputDevice* pOut = 0; if (xRenderDevice.is()) { @@ -3184,13 +2862,16 @@ void SAL_CALL SwXTextDocument::render( aOptions.bPrintRightPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintRightPages" ), aOptions.bPrintRightPage ); aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( C2U( "PrintBackground" ), aOptions.bPrintPageBackground ); aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( C2U( "PrintEmptyPages" ), aOptions.bPrintEmptyPages ); + // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( C2U( "PaperTray" ), aOptions.bPaperFromSetup ); aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( C2U( "PrintReverseOrder" ), aOptions.bPrintReverse ); aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), aOptions.bPrintProspect ); aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochureRTL" ), aOptions.bPrintProspect_RTL ); + // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( C2U( "PrintBlack" ), aOptions.bPrintBlackFont ); aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( C2U( "PrintHiddenText" ), aOptions.bPrintHiddenText ); aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( C2U( "PrintPlaceholder" ), aOptions.bPrintTextPlaceholder ); - aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( C2U( "PaperTray" ), aOptions.bPaperFromSetup ); aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( C2U( "PrintNotes" ), aOptions.nPrintPostIts )); Range aPageRange( nRenderer+1, nRenderer+1 ); @@ -3209,8 +2890,9 @@ void SAL_CALL SwXTextDocument::render( SwViewOptionAdjust_Impl* pViewOptionAdjust = pView->IsA(aSwViewTypeId) ? new SwViewOptionAdjust_Impl(*((SwView*)pView)->GetWrtShellPtr()) : 0; - if (bIsPDFExport) - pVwSh->SetPDFExportOption( sal_True ); + // since printing now also use the API for PDF export this option + // should be set for printing as well ... + pVwSh->SetPDFExportOption( sal_True ); // --> FME 2004-06-08 #i12836# enhanced pdf export // @@ -3229,7 +2911,7 @@ void SAL_CALL SwXTextDocument::render( // <-- // TLPDF OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF - pVwSh->Prt( pOut, aOptions, 0, bIsPDFExport ); + pVwSh->Prt( pOut, aOptions, *m_pPrintUIOptions, nRenderer, 0, bIsPDFExport ); // --> FME 2004-10-08 #i35176# // @@ -3243,8 +2925,7 @@ void SAL_CALL SwXTextDocument::render( } // <-- - if (bIsPDFExport) - pVwSh->SetPDFExportOption( sal_False ); + pVwSh->SetPDFExportOption( sal_False ); // #i96167# haggai: delete pViewOptionsAdjust here because it makes use // of the shell, which might get destroyed in lcl_DisposeView! -- cgit v1.2.3 From 45ad2c0071344539dae16d686dd8dc838a085b33 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 17 Jul 2009 08:40:57 +0000 Subject: fix warnings --- sw/source/core/view/vprint.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 8e50ada89c58..14785e5adf91 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include @@ -431,7 +431,7 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un * Aenderung : ******************************************************************************/ -void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL bPDFExport ) +void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL /*bPDFExport*/ ) { ASSERT( !pSh->GetWin(), "Drucken mit Window?" ); pSh->aVisArea = rRect; @@ -1316,8 +1316,10 @@ BOOL ViewShell::Prt( aMulti = aTmpMulti; // Ende des HACKs +#if 0 const USHORT nSelCount = USHORT(aMulti.GetSelectCount() /* * nCopyCnt*/); +#endif // PostitListe holen _SetGetExpFlds aPostItFields; @@ -1347,8 +1349,8 @@ BOOL ViewShell::Prt( MapMode aOldMapMode; const SwPageDesc *pLastPageDesc = NULL; - BOOL bSetOrient = FALSE; - BOOL bSetPaperSz = FALSE; + // BOOL bSetOrient = FALSE; + // BOOL bSetPaperSz = FALSE; BOOL bSetPrt = FALSE; if ( rOptions.nPrintPostIts != POSTITS_ONLY ) -- cgit v1.2.3 From 3c33f07b5c7079d663b68876d7a156d99f41abdb Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 17 Jul 2009 09:37:10 +0000 Subject: fix warnings --- sw/source/ui/uno/unotxdoc.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 097dbfa7bf96..639133089530 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -2567,6 +2567,7 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS // Otherwise the View should be obtained from the "View" property passed on in the // calls to the XRenderable functions. DBG_ASSERT( bIsPDFExport, "code should have been called for PDF export only..." ); + (void)bIsPDFExport; // avoid warning in non dbg case // used for PDF export of (multi-)selection if (rSelection.hasValue()) // is anything selected ? -- cgit v1.2.3 From 2938f82faeb4d1c7999f06a1b0fe0ad0ef8fb8b9 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 22 Jul 2009 17:16:03 +0000 Subject: #i92516# adapt to new UI spec --- sw/source/core/view/vprint.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 14785e5adf91..2e868a493d30 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -372,7 +372,10 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : sal_False ); // print range selection - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), rtl::OUString(), true, true ); + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ), + true ); // create a choice for the content to create rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); @@ -1259,12 +1262,12 @@ BOOL ViewShell::Prt( /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer <= rPrintUIOptions.GetPagesToPrint().size(), + DBG_ASSERT( 0 <= nRenderer && nRenderer <= sal_Int32(rPrintUIOptions.GetPagesToPrint().size()), "nRenderer out of bounds"); #endif const sal_Int32 nPage = rPrintUIOptions.GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nPage && nPage <= rPrintUIOptions.GetValidStartFrms().size(), + DBG_ASSERT( 0 <= nPage && nPage <= sal_Int32(rPrintUIOptions.GetValidStartFrms().size()), "nPage out of bounds"); #endif const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); -- cgit v1.2.3 From f3c2c59f9df88a6ef538bc438a24bf8cd18001d4 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 23 Jul 2009 17:27:06 +0000 Subject: #i92516# adapt new UX spec --- sw/source/core/view/vprint.cxx | 111 ++++++++++++++++++++--------------------- sw/source/ui/config/optdlg.src | 13 +++-- sw/source/ui/uno/unotxdoc.cxx | 6 +-- 3 files changed, 66 insertions(+), 64 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 2e868a493d30..8ed59b1e19f5 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -52,6 +52,8 @@ #include #include +#include + #include #include #include @@ -238,31 +240,41 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create sequence of print UI options // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 17 : 22; + const int nNumProps = bWeb? 19 : 23; m_aUIProperties.realloc( nNumProps ); int nIdx = 0; - // create Section for Contents (results in an extra tab page in dialog) - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); + // create "writer" section (new tab page in dialog) + SvtModuleOptions aOpt; + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aOpt.GetModuleName( SvtModuleOptions::E_SWRITER ), rtl::OUString() ); + + // create sub section for Contents + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); + + // create a bool option for background + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), + aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), + sal_True ); // create a bool option for graphics m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), aLocalizedStrings.GetString( 2 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphics" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphicsAndDiagrams" ) ), sal_True ); - // create a bool option for tables - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), - aLocalizedStrings.GetString( 4 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTables" ) ), - sal_True ); - if (!bWeb) { - // create a bool option for drawings - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), - aLocalizedStrings.GetString( 6 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDrawings" ) ), - sal_True ); + // create a bool option for hidden text + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), + aLocalizedStrings.GetString( 14 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), + sal_False ); + + // create a bool option for place holder + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), + aLocalizedStrings.GetString( 16 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), + sal_False ); } // create a bool option for controls @@ -271,11 +283,8 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), sal_True ); - // create a bool option for background - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), - aLocalizedStrings.GetString( 10 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), - sal_True ); + // create sub section for Color + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 47 ), rtl::OUString() ); // create a bool option for black m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), @@ -283,21 +292,32 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), sal_False ); - if (!bWeb) - { - // create a bool option for hidden text - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), - aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), - sal_False ); + // create subgroup for misc options + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 34 ) ), rtl::OUString() ); - // create a bool option for place holder - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), - aLocalizedStrings.GetString( 16 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), - sal_False ); - } + // create a bool option for blank pages + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), + aLocalizedStrings.GetString( 36 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + sal_True ); + + // print content selection + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 48 ) ), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPage" ) ) + ); + + // create a bool option for paper tray + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), + aLocalizedStrings.GetString( 38 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), + sal_False ); + // print content selection + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 46 ) ), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ) + ); // create a list box for notes content uno::Sequence< rtl::OUString > aChoices( 4 ); aChoices[0] = aLocalizedStrings.GetString( 19 ); @@ -315,8 +335,8 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) ); - // create Section for Page settings (results in an extra tab page in dialog) - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); + // create subsection for Page settings + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); if (!bWeb) { @@ -333,12 +353,6 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : sal_True ); } - // create a bool option for reversed order (solve in vcl ?) - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 28 ), - aLocalizedStrings.GetString( 29 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverseOrder" ) ), - sal_False ); - // create a bool option for brochure rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), @@ -356,21 +370,6 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : sal_True ); - // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 34 ) ), rtl::OUString() ); - - // create a bool option for blank pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), - aLocalizedStrings.GetString( 36 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - sal_True ); - - // create a bool option for paper tray - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), - aLocalizedStrings.GetString( 38 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), - sal_False ); - // print range selection m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), rtl::OUString(), diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 16d1c57b13ad..0a86f1d5ad5e 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -941,17 +941,17 @@ StringArray STR_PRINTOPTUI ItemList [en-US] = { < "Contents"; >; - < "~Graphics"; >; + < "~Graphics and diagrams"; >; < "Specifies whether the graphics of your text document are printed"; >; < "~Tables"; >; < "Specifies whether the tables of the text document are printed"; >; < "Dra~wings"; >; < "Specifies whether graphics created with %PRODUCTNAME drawing functions are printed."; >; - < "Control~s"; >; + < "Form control~s"; >; < "Specifies whether the form control fields of the text document are printed"; >; - < "Ba~ckground"; >; + < "Page Ba~ckground"; >; < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; - < "Print blac~k"; >; + < "Print text in blac~k"; >; < "Specifies whether to always print text in black."; >; < "Hidden te~xt"; >; < "Enable this option to print text that is marked as hidden."; >; @@ -959,7 +959,7 @@ StringArray STR_PRINTOPTUI < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; < "~Notes"; >; < "Specify where to print notes (if any)."; >; - < "None"; >; + < "Document only"; >; < "Notes only"; >; < " at end of document"; >; < " at end of page"; >; @@ -986,6 +986,9 @@ StringArray STR_PRINTOPTUI < "Print a range of pages of the document."; >; < "~Selection"; >; < "Print only the currently selected content."; >; + < "Print"; >; + < "Color"; >; + < "Paper tray"; >; }; }; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 639133089530..a00933d49dac 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2855,9 +2855,9 @@ void SAL_CALL SwXTextDocument::render( const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); - aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphics" ), aOptions.bPrintGraphic ); - aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( C2U( "PrintTables" ), aOptions.bPrintTable ); - aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( C2U( "PrintDrawings" ), aOptions.bPrintDraw ); + aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintGraphic ); + aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintTable ); + aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintDraw ); aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( C2U( "PrintControls" ), aOptions.bPrintControl ); aOptions.bPrintLeftPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintLeftPages" ), aOptions.bPrintLeftPage ); aOptions.bPrintRightPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintRightPages" ), aOptions.bPrintRightPage ); -- cgit v1.2.3 From 631990a2fd46e66c130c63ed94246836ec59811c Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 23 Jul 2009 17:30:46 +0000 Subject: #i92516# adapt new UX spec --- starmath/source/unomodel.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 241415ef0b22..919a0d821734 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -99,7 +100,8 @@ SmPrintUIOptions::SmPrintUIOptions() m_aUIProperties.realloc( 8 ); // create Section for formula (results in an extra tab page in dialog) - m_aUIProperties[0].Value = getGroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); + SvtModuleOptions aOpt; + m_aUIProperties[0].Value = getGroupControlOpt( aOpt.GetModuleName( SvtModuleOptions::E_SMATH ), rtl::OUString() ); // create subgroup for print options m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); -- cgit v1.2.3 From e47d92b9b01662219a47360016aeccf3c14bbc92 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 25 Jul 2009 10:38:52 +0000 Subject: solve a rebase problem --- starmath/source/unomodel.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 030b7c2cfdb1..8e2cb80324cc 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -956,18 +956,18 @@ static Size lcl_GuessPaperSize() LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() ); if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() ) { - // in Twip - aRes.Width() = lA4Width; - aRes.Height() = lA4Height; + // in 100th mm + PaperInfo aInfo( PAPER_A4 ); + aRes.Width() = aInfo.getWidth(); + aRes.Height() = aInfo.getHeight(); } else { - // in Twip - aRes.Width() = lLetterWidth; - aRes.Height() = lLetterHeight; + // in 100th mm + PaperInfo aInfo( PAPER_LETTER ); + aRes.Width() = aInfo.getWidth(); + aRes.Height() = aInfo.getHeight(); } - aRes = OutputDevice::LogicToLogic( aRes, MapMode(MAP_TWIP), - MapMode(MAP_100TH_MM) ); return aRes; } -- cgit v1.2.3 From f12ec65fe96fb1a0c5824b78f4a38154431eb184 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 25 Jul 2009 10:40:41 +0000 Subject: solve a rebase problem --- starmath/util/makefile.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/starmath/util/makefile.mk b/starmath/util/makefile.mk index 86218d98b6f7..d38e162b21c5 100644 --- a/starmath/util/makefile.mk +++ b/starmath/util/makefile.mk @@ -64,6 +64,7 @@ SHL1STDLIBS= \ $(TKLIB) \ $(VCLLIB) \ $(SVLLIB) \ + $(I18NPAPERLIB) \ $(SOTLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ -- cgit v1.2.3 From e7200b2b026e535228b1fa27d4ab450b8125f2fd Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 28 Jul 2009 09:43:30 +0000 Subject: #i101242# fixed crashwhen printing the page preview with new print UI --- sw/inc/unotxdoc.hxx | 441 +++++++++++++++++++++--------------------- sw/source/ui/inc/unotxvw.hxx | 6 - sw/source/ui/uiview/pview.cxx | 63 +----- sw/source/ui/uno/unotxdoc.cxx | 50 +++-- sw/source/ui/uno/unotxvw.cxx | 24 --- 5 files changed, 258 insertions(+), 326 deletions(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 50851a31e945..7b81a0ce191b 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -115,6 +116,8 @@ public Ifc31 __DEF_IMPLHELPER_EX( 31 ) +namespace css = ::com::sun::star; + class SwDoc; class SwDocShell; class UnoActionContext; @@ -135,37 +138,37 @@ SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) typedef cppu::WeakImplHelper31 < - ::com::sun::star::text::XTextDocument, - ::com::sun::star::text::XLineNumberingProperties, - ::com::sun::star::text::XChapterNumberingSupplier, - ::com::sun::star::text::XNumberingRulesSupplier, - ::com::sun::star::text::XFootnotesSupplier, - ::com::sun::star::text::XEndnotesSupplier, - ::com::sun::star::util::XReplaceable, - ::com::sun::star::text::XPagePrintable, - ::com::sun::star::text::XReferenceMarksSupplier, - ::com::sun::star::text::XTextTablesSupplier, - ::com::sun::star::text::XTextFramesSupplier, - ::com::sun::star::text::XBookmarksSupplier, - ::com::sun::star::text::XTextSectionsSupplier, - ::com::sun::star::text::XTextGraphicObjectsSupplier, - ::com::sun::star::text::XTextEmbeddedObjectsSupplier, - ::com::sun::star::text::XTextFieldsSupplier, - ::com::sun::star::style::XStyleFamiliesSupplier, - ::com::sun::star::style::XAutoStylesSupplier, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::drawing::XDrawPageSupplier, - ::com::sun::star::text::XDocumentIndexesSupplier, - ::com::sun::star::beans::XPropertySet, - ::com::sun::star::beans::XPropertyState, - ::com::sun::star::document::XLinkTargetSupplier, - ::com::sun::star::document::XRedlinesSupplier, - ::com::sun::star::util::XRefreshable, - ::com::sun::star::util::XLinkUpdate, - ::com::sun::star::view::XRenderable, - ::com::sun::star::xforms::XFormsSupplier, - ::com::sun::star::text::XFlatParagraphIteratorProvider, - ::com::sun::star::document::XDocumentLanguages + css::text::XTextDocument, + css::text::XLineNumberingProperties, + css::text::XChapterNumberingSupplier, + css::text::XNumberingRulesSupplier, + css::text::XFootnotesSupplier, + css::text::XEndnotesSupplier, + css::util::XReplaceable, + css::text::XPagePrintable, + css::text::XReferenceMarksSupplier, + css::text::XTextTablesSupplier, + css::text::XTextFramesSupplier, + css::text::XBookmarksSupplier, + css::text::XTextSectionsSupplier, + css::text::XTextGraphicObjectsSupplier, + css::text::XTextEmbeddedObjectsSupplier, + css::text::XTextFieldsSupplier, + css::style::XStyleFamiliesSupplier, + css::style::XAutoStylesSupplier, + css::lang::XServiceInfo, + css::drawing::XDrawPageSupplier, + css::text::XDocumentIndexesSupplier, + css::beans::XPropertySet, + css::beans::XPropertyState, + css::document::XLinkTargetSupplier, + css::document::XRedlinesSupplier, + css::util::XRefreshable, + css::util::XLinkUpdate, + css::view::XRenderable, + css::xforms::XFormsSupplier, + css::text::XFlatParagraphIteratorProvider, + css::document::XDocumentLanguages > SwXTextDocumentBaseClass; @@ -182,39 +185,39 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, sal_Bool bObjectValid; SwXDrawPage* pDrawPage; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > * pxXDrawPage; + css::uno::Reference< css::drawing::XDrawPage > * pxXDrawPage; - ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xBodyText; + css::uno::Reference< css::text::XText > xBodyText; SwXBodyText* pBodyText; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xNumFmtAgg; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > * pxXNumberingRules; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > * pxXFootnotes; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxXFootnoteSettings; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > * pxXEndnotes; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxXEndnoteSettings; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXReferenceMarks; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > * pxXTextFieldTypes; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXTextFieldMasters; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXTextSections; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXBookmarks; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXTextTables; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXTextFrames; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXGraphicObjects; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXEmbeddedObjects; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxXStyleFamilies; - mutable ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyles > * pxXAutoStyles; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > * pxXChapterNumbering; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > * pxXDocumentIndexes; - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxXLineNumberingProperties; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > * pxLinkTargetSupplier; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >* pxXRedlines; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> xXFormsContainer; + css::uno::Reference< css::uno::XAggregation > xNumFmtAgg; + + css::uno::Reference< css::container::XIndexAccess > * pxXNumberingRules; + css::uno::Reference< css::container::XIndexAccess > * pxXFootnotes; + css::uno::Reference< css::beans::XPropertySet > * pxXFootnoteSettings; + css::uno::Reference< css::container::XIndexAccess > * pxXEndnotes; + css::uno::Reference< css::beans::XPropertySet > * pxXEndnoteSettings; + css::uno::Reference< css::container::XNameAccess > * pxXReferenceMarks; + css::uno::Reference< css::container::XEnumerationAccess > * pxXTextFieldTypes; + css::uno::Reference< css::container::XNameAccess > * pxXTextFieldMasters; + css::uno::Reference< css::container::XNameAccess > * pxXTextSections; + css::uno::Reference< css::container::XNameAccess > * pxXBookmarks; + css::uno::Reference< css::container::XNameAccess > * pxXTextTables; + css::uno::Reference< css::container::XNameAccess > * pxXTextFrames; + css::uno::Reference< css::container::XNameAccess > * pxXGraphicObjects; + css::uno::Reference< css::container::XNameAccess > * pxXEmbeddedObjects; + css::uno::Reference< css::container::XNameAccess > * pxXStyleFamilies; + mutable css::uno::Reference< css::style::XAutoStyles > * pxXAutoStyles; + css::uno::Reference< css::container::XIndexReplace > * pxXChapterNumbering; + css::uno::Reference< css::container::XIndexAccess > * pxXDocumentIndexes; + + css::uno::Reference< css::beans::XPropertySet > * pxXLineNumberingProperties; + css::uno::Reference< css::container::XNameAccess > * pxLinkTargetSupplier; + css::uno::Reference< css::container::XEnumerationAccess >* pxXRedlines; + css::uno::Reference< css::container::XNameContainer> xXFormsContainer; //temporary frame to enable PDF export if no valid view is available SfxViewFrame* m_pHiddenViewFrame; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xPropertyHelper; + css::uno::Reference< css::uno::XInterface> xPropertyHelper; SwXDocumentPropertyHelper* pPropertyHelper; SwPrintUIOptions* m_pPrintUIOptions; @@ -223,8 +226,8 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, void GetNumberFormatter(); // used for XRenderable implementation - SfxViewShell * GuessViewShell(); - SwDoc * GetRenderDoc( SfxViewShell *&rpView, const ::com::sun::star::uno::Any& rSelection, bool bIsPDFExport ); + SfxViewShell * GuessViewShell( const css::uno::Reference< css::frame::XController > xController = css::uno::Reference< css::frame::XController >() ); + SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport ); rtl::OUString maBuildId; @@ -237,173 +240,173 @@ public: SwXTextDocument(SwDocShell* pShell); inline void notifyRefreshListeners() { aRefreshCont.Refreshed(); } - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException); virtual void SAL_CALL acquire( ) throw(); virtual void SAL_CALL release( ) throw(); //XWeak - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAdapter > SAL_CALL queryAdapter( ) throw(::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter( ) throw(css::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException); - SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + SW_DLLPUBLIC static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException); //XTextDocument - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL reformat(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::text::XText > SAL_CALL getText(void) throw( css::uno::RuntimeException ); + virtual void SAL_CALL reformat(void) throw( css::uno::RuntimeException ); //XModel - virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL lockControllers( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unlockControllers( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasControllersLocked( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL getCurrentController( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) throw(css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(css::uno::RuntimeException); + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) throw(css::uno::RuntimeException); + virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) throw(css::uno::RuntimeException); + virtual void SAL_CALL lockControllers( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL unlockControllers( ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasControllersLocked( ) throw(css::uno::RuntimeException); + virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) throw(css::container::NoSuchElementException, css::uno::RuntimeException); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection( ) throw(css::uno::RuntimeException); //XComponent - virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL dispose(void) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException ); //XCloseable - virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException); //XLineNumberingProperties - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getLineNumberingProperties(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getLineNumberingProperties(void) throw( css::uno::RuntimeException ); //XChapterNumberingSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SAL_CALL getChapterNumberingRules(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XIndexReplace > SAL_CALL getChapterNumberingRules(void) throw( css::uno::RuntimeException ); //XNumberingRulesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getNumberingRules() throw (::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getNumberingRules() throw (css::uno::RuntimeException); //XFootnotesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getFootnotes(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getFootnoteSettings(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getFootnotes(void) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFootnoteSettings(void) throw( css::uno::RuntimeException ); //XEndnotesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getEndnotes(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getEndnoteSettings(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getEndnotes(void) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEndnoteSettings(void) throw( css::uno::RuntimeException ); //XReplaceable - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Int32 SAL_CALL replaceAll(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & xDesc) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor(void) throw( css::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL replaceAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException ); //XSearchable - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > SAL_CALL createSearchDescriptor(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL findAll(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & xDesc) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL findFirst(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & xDesc) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL findNext(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xStartAt, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & xDesc) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL createSearchDescriptor(void) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL findAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findFirst(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findNext(const css::uno::Reference< css::uno::XInterface > & xStartAt, const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) throw( css::uno::RuntimeException ); //XPagePrintable - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPagePrintSettings(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setPagePrintSettings(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aSettings) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL printPages(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPagePrintSettings(void) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setPagePrintSettings(const css::uno::Sequence< css::beans::PropertyValue >& aSettings) throw( css::uno::RuntimeException ); + virtual void SAL_CALL printPages(const css::uno::Sequence< css::beans::PropertyValue >& xOptions) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException ); //XReferenceMarksSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getReferenceMarks(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getReferenceMarks(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XTextFieldsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL getTextFields(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTextFieldMasters(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XTextFieldsSupplier + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields(void) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XTextEmbeddedObjectsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getEmbeddedObjects(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XTextEmbeddedObjectsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getEmbeddedObjects(void) throw( css::uno::RuntimeException ); -// // ::com::sun::star::text::XTextShapesSupplier -// virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > getShapes(void) throw( ::com::sun::star::uno::RuntimeException ); +// // css::text::XTextShapesSupplier +// virtual css::uno::Reference< css::container::XIndexAccess > getShapes(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XBookmarksSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getBookmarks(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XBookmarksSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XTextSectionsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTextSections(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XTextSectionsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextSections(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XTextTablesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTextTables(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XTextTablesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextTables(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XTextGraphicObjectsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGraphicObjects(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XTextGraphicObjectsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGraphicObjects(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XTextFramesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTextFrames(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XTextFramesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFrames(void) throw( css::uno::RuntimeException ); //XStyleFamiliesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getStyleFamilies(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies(void) throw( css::uno::RuntimeException ); //XAutoStylesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XAutoStyles > SAL_CALL getAutoStyles( ) throw (::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::style::XAutoStyles > SAL_CALL getAutoStyles( ) throw (css::uno::RuntimeException); //XMultiServiceFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance(const rtl::OUString& ServiceSpecifier) - throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(const rtl::OUString& ServiceSpecifier, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments) - throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames(void) - throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const rtl::OUString& ServiceSpecifier) + throw( css::uno::Exception, css::uno::RuntimeException ); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const rtl::OUString& ServiceSpecifier, + const css::uno::Sequence< css::uno::Any >& Arguments) + throw( css::uno::Exception, css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames(void) + throw( css::uno::RuntimeException ); //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::drawing::XDrawPageSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getDrawPage(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::drawing::XDrawPageSupplier + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage(void) throw( css::uno::RuntimeException ); - // ::com::sun::star::text::XDocumentIndexesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getDocumentIndexes(void) throw( ::com::sun::star::uno::RuntimeException ); + // css::text::XDocumentIndexesSupplier + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDocumentIndexes(void) throw( css::uno::RuntimeException ); //XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); //XPropertyState - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual css::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& rPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< ::rtl::OUString >& rPropertyNames ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& rPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); //XLinkTargetSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks(void) throw( css::uno::RuntimeException ); //XRedlinesSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL getRedlines( ) throw(::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getRedlines( ) throw(css::uno::RuntimeException); - // ::com::sun::star::util::XRefreshable - virtual void SAL_CALL refresh(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addRefreshListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener > & l) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeRefreshListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener > & l) throw( ::com::sun::star::uno::RuntimeException ); + // css::util::XRefreshable + virtual void SAL_CALL refresh(void) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) throw( css::uno::RuntimeException ); - // ::com::sun::star::util::XLinkUpdate, - virtual void SAL_CALL updateLinks( ) throw(::com::sun::star::uno::RuntimeException); + // css::util::XLinkUpdate, + virtual void SAL_CALL updateLinks( ) throw(css::uno::RuntimeException); - // ::com::sun::star::view::XRenderable - virtual sal_Int32 SAL_CALL getRendererCount( const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + // css::view::XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); + virtual void SAL_CALL render( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); - // ::com::sun::star::xforms::XFormsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getXForms( ) throw (::com::sun::star::uno::RuntimeException); + // css::xforms::XFormsSupplier + virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getXForms( ) throw (css::uno::RuntimeException); - // ::com::sun::star::document::XDocumentLanguages - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getDocumentLanguages( ::sal_Int16 nScriptTypes, ::sal_Int16 nCount ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + // css::document::XDocumentLanguages + virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getDocumentLanguages( ::sal_Int16 nScriptTypes, ::sal_Int16 nCount ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); - // ::com::sun::star::text::XFlatParagraphIteratorProvider: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) throw (::com::sun::star::uno::RuntimeException); + // css::text::XFlatParagraphIteratorProvider: + virtual css::uno::Reference< css::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) throw (css::uno::RuntimeException); // void Invalidate(); @@ -413,11 +416,11 @@ public: void InitNewDoc(); - SwUnoCrsr* CreateCursorForSearch(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > & xCrsr); - SwUnoCrsr* FindAny(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & xDesc, - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > & xCrsr, sal_Bool bAll, + SwUnoCrsr* CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > & xCrsr); + SwUnoCrsr* FindAny(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc, + css::uno::Reference< css::text::XTextCursor > & xCrsr, sal_Bool bAll, sal_Int32& nResult, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xLastResult); + css::uno::Reference< css::uno::XInterface > xLastResult); SwXDrawPage* GetDrawPage(); SwDocShell* GetDocShell() {return pDocShell;} @@ -431,8 +434,8 @@ public: --------------------------------------------------*/ class SwXLinkTargetSupplier : public cppu::WeakImplHelper2 < - ::com::sun::star::container::XNameAccess, - ::com::sun::star::lang::XServiceInfo + css::container::XNameAccess, + css::lang::XServiceInfo > { SwXTextDocument* pxDoc; @@ -449,18 +452,18 @@ public: ~SwXLinkTargetSupplier(); //XNameAccess - virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( css::uno::RuntimeException ); //XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + virtual css::uno::Type SAL_CALL getElementType( ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(css::uno::RuntimeException); //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException ); // void Invalidate() {pxDoc = 0;} @@ -470,52 +473,52 @@ public: --------------------------------------------------*/ class SwXLinkNameAccessWrapper : public cppu::WeakImplHelper4 < - ::com::sun::star::beans::XPropertySet, - ::com::sun::star::container::XNameAccess, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::document::XLinkTargetSupplier + css::beans::XPropertySet, + css::container::XNameAccess, + css::lang::XServiceInfo, + css::document::XLinkTargetSupplier > { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xRealAccess; + css::uno::Reference< css::container::XNameAccess > xRealAccess; const SfxItemPropertySet* pPropSet; const String sLinkSuffix; const String sLinkDisplayName; - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > xDoc; + css::uno::Reference< css::text::XTextDocument > xDoc; SwXTextDocument* pxDoc; public: - SwXLinkNameAccessWrapper(::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xAccess, + SwXLinkNameAccessWrapper(css::uno::Reference< css::container::XNameAccess > xAccess, const String& rLinkDisplayName, String sSuffix); SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc, const String& rLinkDisplayName, String sSuffix); ~SwXLinkNameAccessWrapper(); //XNameAccess - virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( css::uno::RuntimeException ); //XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + virtual css::uno::Type SAL_CALL getElementType( ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(css::uno::RuntimeException); //XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); //XLinkTargetSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks(void) throw( css::uno::RuntimeException ); //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException ); }; /* -----------------26.10.99 15:46------------------- @@ -523,8 +526,8 @@ public: --------------------------------------------------*/ class SwXOutlineTarget : public cppu::WeakImplHelper2 < - ::com::sun::star::beans::XPropertySet, - ::com::sun::star::lang::XServiceInfo + css::beans::XPropertySet, + css::lang::XServiceInfo > { const SfxItemPropertySet* pPropSet; @@ -535,36 +538,36 @@ public: ~SwXOutlineTarget(); //XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( css::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( css::uno::RuntimeException ); }; #endif class SwXDocumentPropertyHelper : public SvxUnoForbiddenCharsTable { - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xDashTable; - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xGradientTable; - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xHatchTable; - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xBitmapTable; - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xTransGradientTable; - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xMarkerTable; - com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xDrawDefaults; + css::uno::Reference < css::uno::XInterface > xDashTable; + css::uno::Reference < css::uno::XInterface > xGradientTable; + css::uno::Reference < css::uno::XInterface > xHatchTable; + css::uno::Reference < css::uno::XInterface > xBitmapTable; + css::uno::Reference < css::uno::XInterface > xTransGradientTable; + css::uno::Reference < css::uno::XInterface > xMarkerTable; + css::uno::Reference < css::uno::XInterface > xDrawDefaults; SwDoc* m_pDoc; public: SwXDocumentPropertyHelper(SwDoc& rDoc); ~SwXDocumentPropertyHelper(); - com::sun::star::uno::Reference GetDrawTable(short nWhich); + css::uno::Reference GetDrawTable(short nWhich); void Invalidate(); virtual void onChange(); diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx index 794371499186..4db18720cf87 100644 --- a/sw/source/ui/inc/unotxvw.hxx +++ b/sw/source/ui/inc/unotxvw.hxx @@ -72,7 +72,6 @@ class SwXTextView : public ::com::sun::star::view::XViewSettingsSupplier, public ::com::sun::star::beans::XPropertySet, public ::com::sun::star::datatransfer::XTransferableSupplier, - public ::com::sun::star::lang::XUnoTunnel, public SfxBaseController { SelectionChangeListenerArr aSelChangedListeners; @@ -153,11 +152,6 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException); - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); - - static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - void NotifySelChanged(); void NotifyDBChanged(); diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index c2512a3e5d2a..e9b8094d0e7f 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -2415,65 +2416,9 @@ void SwPagePreView::ScrollDocSzChg() USHORT SwPagePreView::Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pDlg ) { - ViewShell* pSh = aViewWin.GetViewShell(); - SfxPrinter* pPrinter = GetPrinter(); - if( !pPrinter || !pPrinter->InitJob( &aViewWin, - pSh->HasDrawView() && !bIsAPI && pSh->GetDrawView()->GetModel()->HasTransparentObjects() )) - return ERRCODE_IO_ABORT; - - SwWait aWait( *GetDocShell(), TRUE ); - - USHORT nRowCol = ( aViewWin.GetRow() << 8 ) + - aViewWin.GetCol(); // Zeilen / DoppelSeiten - - { - // die Felder aktualisieren - // ACHTUNG: hochcasten auf die EditShell, um die SS zu nutzen. - // In den Methoden wird auf die akt. Shell abgefragt! - SwEditShell* pESh = (SwEditShell*)pSh; - SwDocStat aDocStat; - BOOL bIsModified = pESh->IsModified(); - - pESh->StartAllAction(); - pESh->UpdateDocStat( aDocStat ); - pSh->UpdateFlds(); - pESh->EndAllAction(); - - if( !bIsModified ) - pESh->ResetModified(); - } - - // Druckauftrag starten - SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell(); - SwPrtOptions aOpts( pObjShell->GetTitle(0) ); - - BOOL bPrtPros; - BOOL bPrtPros_RTL; - SwView::MakeOptions( pDlg, aOpts, &bPrtPros, &bPrtPros_RTL, FALSE, GetPrinter(), GetDocShell()->GetDoc()->getPrintData() ); - - if( bNormalPrint ) - { - if( bPrtPros ) - pSh->PrintProspect( aOpts, rProgress, bPrtPros_RTL ); - else - { -#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer - pSh->Prt( pPrinter, aOpts, &rProgress ); /*TLPDF*/ -#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer - } - } - else - { - const SwPagePreViewPrtData* pPPVPD = pSh->GetDoc()->GetPreViewPrtData(); - if( pPPVPD && pPPVPD->GetCol() && pPPVPD->GetRow() ) - { - // Zeilen / Seiten - nRowCol = ( pPPVPD->GetRow() << 8 ) + pPPVPD->GetCol(); - } - else - pPPVPD = 0; - pSh->PrintPreViewPage( aOpts, nRowCol, rProgress, pPPVPD ); - } + (void) rProgress; (void) bIsAPI; (void) pDlg; + // TLPDF no longer needed in new print UI + // TLPDF TODO: clean-up return 0; // OK } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index a00933d49dac..5ea1e3f5bb1b 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2733,7 +2733,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( /* -----------------------------28.10.02 16:00-------------------------------- ---------------------------------------------------------------------------*/ -SfxViewShell * SwXTextDocument::GuessViewShell() +SfxViewShell * SwXTextDocument::GuessViewShell( + const uno::Reference< css::frame::XController > xController ) { // #130810# SfxViewShell::Current() / SfxViewShell::GetObjectShell() // must not be used (see comment from MBA) @@ -2742,18 +2743,30 @@ SfxViewShell * SwXTextDocument::GuessViewShell() SwView *pSwView = 0; SwPagePreView *pSwPagePreView = 0; SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False ); + + // look for the view shell with the same controller in use, + // otherwise look for a suitable view, preferably a SwView, + // if that one is not found use a SwPagePreView if found. while (pFrame) { pView = pFrame->GetViewShell(); pSwView = dynamic_cast< SwView * >(pView); - if (pSwView) - break; if (!pSwPagePreView) pSwPagePreView = dynamic_cast< SwPagePreView * >(pView); + if (xController.is()) + { + if (pView && pView->GetController() == xController) + break; + } + else if (pSwView) + break; pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); } - return pSwView ? pSwView : dynamic_cast< SwView * >(pSwPagePreView); + DBG_ASSERT( pSwView || pSwPagePreView, "failed to get view shell" ); + return pSwView ? + dynamic_cast< SfxViewShell * >(pSwView) : + dynamic_cast< SfxViewShell * >(pSwPagePreView); } /* -----------------------------23.08.02 16:00-------------------------------- @@ -2788,15 +2801,8 @@ void SAL_CALL SwXTextDocument::render( uno::Reference< frame::XController > xController; if (aTmp >>= xController) { - uno::Reference< lang::XUnoTunnel > xTunnel( xController, uno::UNO_QUERY ); - if (xTunnel.is()) - { - SwXTextView *pTextView = reinterpret_cast< SwXTextView * >( - sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXTextView::getUnoTunnelId()) )); - if (pTextView) - pView = pTextView->GetView(); - } - + DBG_ASSERT( xController.is(), "controller is empty!" ); + pView = GuessViewShell( xController ); } } @@ -2808,18 +2814,26 @@ void SAL_CALL SwXTextDocument::render( // due to #110067# (document page count changes sometimes during // PDF export/printing) we can not check for the upper bound properly. // Thus instead of throwing the exception we silently return. - if (!(0 <= nRenderer /* && nRenderer < pDoc->GetPageCount()*/)) + if (0 > nRenderer) throw IllegalArgumentException(); - if (nRenderer >= pDoc->GetPageCount()) + const sal_Int32 nMaxCount = bIsPDFExport? + static_cast< sal_Int32 >(pDoc->GetPageCount()) : + static_cast< sal_Int32 >(m_pPrintUIOptions->GetPagesToPrint().size()); + if (nRenderer >= nMaxCount) return; // the view shell should be SwView for documents PDF export // or SwPagePreView for PDF export of the page preview //!! (check for SwView first as in GuessViewShell) !! + DBG_ASSERT( pView, "!! view missing !!" ); const TypeId aSwViewTypeId = TYPE(SwView); - ViewShell* pVwSh = pView->IsA(aSwViewTypeId) ? - ((SwView*)pView)->GetWrtShellPtr() : - ((SwPagePreView*)pView)->GetViewShell(); + ViewShell* pVwSh = 0; + if (pView) + { + pVwSh = pView->IsA(aSwViewTypeId) ? + ((SwView*)pView)->GetWrtShellPtr() : + ((SwPagePreView*)pView)->GetViewShell(); + } uno::Reference< awt::XDevice > xRenderDevice; bool bFirstPage = false; diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index a91a1ca26a6a..667d0f987783 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -293,11 +293,6 @@ uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType ) uno::Reference xRet = this; aRet.setValue(&xRet, aType); } - else if(aType == ::getCppuType((uno::Reference*)0)) - { - uno::Reference xRet = this; - aRet.setValue(&xRet, aType); - } else aRet = SfxBaseController::queryInterface(aType); return aRet; @@ -2220,24 +2215,5 @@ void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfe } } -const uno::Sequence< sal_Int8 > & SwXTextView::getUnoTunnelId() -{ - static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); - return aSeq; -} - -sal_Int64 SAL_CALL SwXTextView::getSomething( - const uno::Sequence< sal_Int8 >& rId ) -throw(uno::RuntimeException) -{ - if( rId.getLength() == 16 - && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } - return 0; -} - // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 938fa6d43dbf395adc0aaee52d694ccd815fc8ad Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 28 Jul 2009 13:36:59 +0000 Subject: #i101242# print-preview toolbar changes --- sw/uiconfig/sglobal/toolbar/previewobjectbar.xml | 1 - sw/uiconfig/sweb/toolbar/previewobjectbar.xml | 1 - sw/uiconfig/swform/toolbar/previewobjectbar.xml | 1 - sw/uiconfig/swreport/toolbar/previewobjectbar.xml | 1 - sw/uiconfig/swriter/toolbar/previewobjectbar.xml | 1 - sw/uiconfig/swxform/toolbar/previewobjectbar.xml | 1 - 6 files changed, 6 deletions(-) diff --git a/sw/uiconfig/sglobal/toolbar/previewobjectbar.xml b/sw/uiconfig/sglobal/toolbar/previewobjectbar.xml index a1a2c2f84f89..f0dc732d4ef9 100644 --- a/sw/uiconfig/sglobal/toolbar/previewobjectbar.xml +++ b/sw/uiconfig/sglobal/toolbar/previewobjectbar.xml @@ -19,7 +19,6 @@ - diff --git a/sw/uiconfig/sweb/toolbar/previewobjectbar.xml b/sw/uiconfig/sweb/toolbar/previewobjectbar.xml index a1c2fe8ded6e..5c6d30522614 100644 --- a/sw/uiconfig/sweb/toolbar/previewobjectbar.xml +++ b/sw/uiconfig/sweb/toolbar/previewobjectbar.xml @@ -19,7 +19,6 @@ - diff --git a/sw/uiconfig/swform/toolbar/previewobjectbar.xml b/sw/uiconfig/swform/toolbar/previewobjectbar.xml index 8278110f8e4c..435250b63af5 100644 --- a/sw/uiconfig/swform/toolbar/previewobjectbar.xml +++ b/sw/uiconfig/swform/toolbar/previewobjectbar.xml @@ -19,7 +19,6 @@ - diff --git a/sw/uiconfig/swreport/toolbar/previewobjectbar.xml b/sw/uiconfig/swreport/toolbar/previewobjectbar.xml index 8278110f8e4c..435250b63af5 100644 --- a/sw/uiconfig/swreport/toolbar/previewobjectbar.xml +++ b/sw/uiconfig/swreport/toolbar/previewobjectbar.xml @@ -19,7 +19,6 @@ - diff --git a/sw/uiconfig/swriter/toolbar/previewobjectbar.xml b/sw/uiconfig/swriter/toolbar/previewobjectbar.xml index 8278110f8e4c..435250b63af5 100644 --- a/sw/uiconfig/swriter/toolbar/previewobjectbar.xml +++ b/sw/uiconfig/swriter/toolbar/previewobjectbar.xml @@ -19,7 +19,6 @@ - diff --git a/sw/uiconfig/swxform/toolbar/previewobjectbar.xml b/sw/uiconfig/swxform/toolbar/previewobjectbar.xml index 8278110f8e4c..435250b63af5 100644 --- a/sw/uiconfig/swxform/toolbar/previewobjectbar.xml +++ b/sw/uiconfig/swxform/toolbar/previewobjectbar.xml @@ -19,7 +19,6 @@ - -- cgit v1.2.3 From f13d8939b34c57bc3c7f846ca13c2a627e5cafe8 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 28 Jul 2009 19:02:52 +0000 Subject: #i92518# adapt UI spec --- starmath/source/unomodel.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 8e2cb80324cc..03cea1d20e5f 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -142,13 +142,14 @@ SmPrintUIOptions::SmPrintUIOptions() ); // create a numeric box for scale dependent on PrintFormat = "Scaling" (matches to SID_PRINTZOOM) + vcl::PrinterOptionsHelper::UIControlOptions aRangeOpt( aPrintFormatProp, 2, sal_True ); m_aUIProperties[ 7 ].Value = getRangeControlOpt( rtl::OUString(), aLocalizedStrings.GetString( 14 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_PRINT_SCALE ) ), pConfig->GetPrintZoomFactor(), // initial value 10, // min value 1000, // max value - &aPrintFormatProp, 2 , sal_True ); + aRangeOpt ); // IsIgnoreSpacesRight is a parser option! Thus we don't add it to the printer UI. // -- cgit v1.2.3 From bbca31dd7f98e9e1c7f79be366191f7d39430877 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 28 Jul 2009 19:03:24 +0000 Subject: #i92518# adapt UI spec --- sw/inc/swprtopt.hxx | 2 ++ sw/source/core/doc/doc.cxx | 6 ++-- sw/source/core/view/vprint.cxx | 78 ++++++++++++++++++++++++++---------------- sw/source/ui/config/optdlg.src | 5 +++ sw/source/ui/uno/unotxdoc.cxx | 10 ++++-- 5 files changed, 67 insertions(+), 34 deletions(-) diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index d2b45b37d234..b8a48d678f1a 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -120,6 +120,8 @@ public: const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } + bool isPrintLeftPages() const; + bool isPrintRightPages() const; }; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2e92d8adb89b..9a4f94c9de80 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -999,8 +999,8 @@ void SwDoc::GetValidPagesForPrinting( return; // properties to take into account when calcualting the set of pages - const bool bPrintLeftPage = rPrintUIOptions.getBoolValue( C2U( "PrintLeftPages" ), false ); - const bool bPrintRightPage = rPrintUIOptions.getBoolValue( C2U( "PrintRightPages" ), false ); + const bool bPrintLeftPage = rPrintUIOptions.isPrintLeftPages(); + const bool bPrintRightPage = rPrintUIOptions.isPrintRightPages(); const bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); const bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 19bdd5c8145b..a13396da99b0 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -240,7 +240,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create sequence of print UI options // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 19 : 23; + const int nNumProps = bWeb? 18 : 21; m_aUIProperties.realloc( nNumProps ); int nIdx = 0; @@ -301,22 +301,22 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), sal_True ); - // print content selection - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 48 ) ), - rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPage" ) ) - ); - // create a bool option for paper tray + vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; + aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), aLocalizedStrings.GetString( 38 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), - sal_False ); + sal_False, + aPaperTrayOpt + ); // print content selection + vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; + aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 46 ) ), rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ) + aContentsOpt ); // create a list box for notes content uno::Sequence< rtl::OUString > aChoices( 4 ); @@ -336,21 +336,24 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : ); // create subsection for Page settings - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 23 ), rtl::OUString() ); + vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt; + aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); if (!bWeb) { - // create a bool option for left pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 24 ), - aLocalizedStrings.GetString( 25 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftPages" ) ), - sal_True ); - - // create a bool option for right pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 26 ), - aLocalizedStrings.GetString( 27 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRightPages" ) ), - sal_True ); + uno::Sequence< rtl::OUString > aRLChoices( 3 ); + aRLChoices[0] = aLocalizedStrings.GetString( 51 ); + aRLChoices[1] = aLocalizedStrings.GetString( 52 ); + aRLChoices[2] = aLocalizedStrings.GetString( 53 ); + uno::Sequence< rtl::OUString > aRLHelp( 1 ); + aRLHelp[0] = aLocalizedStrings.GetString( 50 ); + // create a choice option for all/left/right pages + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 49 ), + aRLHelp, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), + aRLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aPageSetOpt + ); } // create a bool option for brochure @@ -358,23 +361,28 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), aLocalizedStrings.GetString( 31 ), aBrochurePropertyName, - sal_False ); + sal_False, + aPageSetOpt + ); // create a bool option for brochure RTL dependent on brochure + vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); + aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), aLocalizedStrings.GetString( 33 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), sal_False, - &aBrochurePropertyName, - -1, - sal_True + aBrochureRTLOpt ); // print range selection + vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; + aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); + aPrintRangeOpt.mbInternalOnly = sal_True; m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ), - true ); + aPrintRangeOpt + ); // create a choice for the content to create rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); @@ -392,17 +400,29 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aChoices, 0 ); // create a an Edit dependent on "Pages" selected + vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), rtl::OUString(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), rtl::OUString(), - &aPrintRangeName, 1, sal_True - ); + aPageRangeOpt + ); DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } +bool SwPrintUIOptions::isPrintLeftPages() const +{ + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); + return nLRPages == 0 || nLRPages == 1; +} + +bool SwPrintUIOptions::isPrintRightPages() const +{ + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); + return nLRPages == 0 || nLRPages == 2; +} bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) { diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 0a86f1d5ad5e..24692190abdf 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -989,6 +989,11 @@ StringArray STR_PRINTOPTUI < "Print"; >; < "Color"; >; < "Paper tray"; >; + < "Include"; >; + < "Specify which pages to include in the output"; >; + < "left and right pages"; >; + < "left pages"; >; + < "right pages"; >; }; }; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 5ea1e3f5bb1b..027b787db29d 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2869,12 +2869,18 @@ void SAL_CALL SwXTextDocument::render( const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); + sal_Int64 nLeftRightPages = 0; + if( ! aOptions.bPrintLeftPage ) + nLeftRightPages = 2; + if( ! aOptions.bPrintRightPage ) + nLeftRightPages = 1; + nLeftRightPages = m_pPrintUIOptions->getIntValue( "PrintLeftRightPages", nLeftRightPages ); aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintGraphic ); aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintTable ); aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintDraw ); aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( C2U( "PrintControls" ), aOptions.bPrintControl ); - aOptions.bPrintLeftPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintLeftPages" ), aOptions.bPrintLeftPage ); - aOptions.bPrintRightPage = m_pPrintUIOptions->getBoolValue( C2U( "PrintRightPages" ), aOptions.bPrintRightPage ); + aOptions.bPrintLeftPage = nLeftRightPages == 0 || nLeftRightPages == 1; + aOptions.bPrintRightPage = nLeftRightPages == 0 || nLeftRightPages == 2; aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( C2U( "PrintBackground" ), aOptions.bPrintPageBackground ); aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( C2U( "PrintEmptyPages" ), aOptions.bPrintEmptyPages ); // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? -- cgit v1.2.3 From 3c93e8d423b0f7c3f448fd1e7ccf06fce0b307cd Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 29 Jul 2009 09:01:57 +0000 Subject: #i101242# print-preview toolbar changes --- sw/inc/cmdid.h | 1 - sw/sdi/swriter.sdi | 25 ------------------------- sw/sdi/swslots.src | 6 +----- sw/sdi/viewsh.sdi | 4 ---- sw/source/ui/app/mn.src | 6 ------ sw/source/ui/uiview/pview.cxx | 6 ------ sw/source/ui/uiview/pview.src | 5 ----- 7 files changed, 1 insertion(+), 52 deletions(-) diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 1fab6f1d15d4..8d56735d17a9 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -324,7 +324,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_GLOBAL_OPEN (FN_VIEW + 47) /* oeffnen */ #define FN_GLOBAL_SAVE_CONTENT (FN_VIEW + 48) /* Inhalt der Verknuepfung mitspeichern */ #define FN_CREATE_NAVIGATION (FN_VIEW + 49) /* Navigations-Controller erzeugen */ -#define FN_PREVIEW_PRINT_OPTIONS (FN_VIEW + 50) /* Optionsdialog Preview drucken */ #define FN_PREVIEW_ZOOM (FN_VIEW + 51) /* der Tabellencontroller fuer den Zoom */ #define FN_SET_MODOPT_TBLNUMFMT (FN_VIEW + 52) /* Zahlenerkennung in Tabellen */ diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 784100694d4a..97093e15a04f 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -6533,31 +6533,6 @@ SfxInt16Item PasteSpecial FN_PASTESPECIAL GroupId = GID_EDIT; ] -//-------------------------------------------------------------------------- -SfxVoidItem PreviewPrintOptions FN_PREVIEW_PRINT_OPTIONS -() -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = TRUE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_DOC; -] - //-------------------------------------------------------------------------- SfxVoidItem PreviewZoom FN_PREVIEW_ZOOM ( SfxUInt16Item PreviewZoom FN_PREVIEW_ZOOM ) diff --git a/sw/sdi/swslots.src b/sw/sdi/swslots.src index d62d1da6b35b..0638e462a7ab 100644 --- a/sw/sdi/swslots.src +++ b/sw/sdi/swslots.src @@ -902,10 +902,6 @@ SfxSlotInfo FN_PREV_WORD_SEL { Slotname [ en-US ] = "Select to Begin of Word"; }; -SfxSlotInfo FN_PREVIEW_PRINT_OPTIONS -{ - Slotname [ en-US ] = "Print options page view"; -}; SfxSlotInfo FN_PREVIEW_ZOOM { Slotname [ en-US ] = "Preview Zoom"; @@ -916,7 +912,7 @@ SfxSlotInfo FN_PRINT_LAYOUT }; SfxSlotInfo FN_PRINT_PAGEPREVIEW { - Slotname [ en-US ] = "Print page view"; + Slotname [ en-US ] = "Print document"; }; SfxSlotInfo FN_MAILMERGE_WIZARD { diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi index 18d537144c5b..1f3113ffe286 100644 --- a/sw/sdi/viewsh.sdi +++ b/sw/sdi/viewsh.sdi @@ -218,10 +218,6 @@ interface TextPrintPreview : View ExecMethod = Execute ; StateMethod = GetState ; ] - FN_PREVIEW_PRINT_OPTIONS //status() - [ - ExecMethod = Execute ; - ] FN_PRINT_PAGEPREVIEW // status() [ ExecMethod = Execute ; diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src index e13d2418cc58..b07ec9cd984a 100644 --- a/sw/source/ui/app/mn.src +++ b/sw/source/ui/app/mn.src @@ -1053,12 +1053,6 @@ Menu MN_PPREVIEW_POPUPMENU HelpID = FN_PRINT_PAGEPREVIEW ; Text [ en-US ] = "Print" ; }; - MenuItem - { - Identifier = FN_PREVIEW_PRINT_OPTIONS; - HelpID = FN_PREVIEW_PRINT_OPTIONS; - Text [ en-US ] = "Print Options"; - }; SEPARATOR ; MenuItem { diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index e9b8094d0e7f..1dc6c393dfcf 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1521,12 +1521,6 @@ MOVEPAGE: rReq.SetSlot( FN_PRINT_PAGEPREVIEW ); return; } - case FN_PREVIEW_PRINT_OPTIONS : - { - SwPreviewPrintOptionsDialog aDlg(aViewWin, *this); - aDlg.Execute(); - } - break; case SID_PRINTDOCDIRECT: case SID_PRINTDOC: ::SetAppPrintOptions( aViewWin.GetViewShell(), FALSE ); diff --git a/sw/source/ui/uiview/pview.src b/sw/source/ui/uiview/pview.src index a213c8df80e7..ff7f834db7a6 100644 --- a/sw/source/ui/uiview/pview.src +++ b/sw/source/ui/uiview/pview.src @@ -453,11 +453,6 @@ ToolBox RID_PVIEW_TOOLBOX Identifier = FN_PRINT_PAGEPREVIEW ; HelpID = FN_PRINT_PAGEPREVIEW ; }; - ToolBoxItem - { - Identifier = FN_PREVIEW_PRINT_OPTIONS ; - HelpID = FN_PREVIEW_PRINT_OPTIONS ; - }; ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; }; ToolBoxItem { -- cgit v1.2.3 From f1c760737a33e1afc96d949149f6104fff110976 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 1 Aug 2009 15:16:11 +0000 Subject: #i92518# lates UI changes --- starmath/source/smres.src | 49 +++++++++++++++++++++--------------------- starmath/source/unomodel.cxx | 9 +++++--- sw/source/core/view/vprint.cxx | 7 ++++-- sw/source/ui/config/optdlg.src | 1 + 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/starmath/source/smres.src b/starmath/source/smres.src index 6939bd328283..bd87f9925b59 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -114,14 +114,14 @@ ModalDialog RID_FONTSIZEDIALOG SVLook = TRUE ; HelpID = SID_FONTSIZE ; Size = MAP_APPFONT ( 171 , 120 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Schriftgrößen : Schriftgrößen */ + /* ### ACHTUNG: Neuer Text in Resource? Schriftgr��en : Schriftgr��en */ Text [ en-US ] = "Font Sizes" ; FixedText 1 { Left = TRUE ; Pos = MAP_APPFONT ( 12 , 7 ) ; Size = MAP_APPFONT ( 40 , 10 ) ; - /* ### ACHTUNG: Neuer Text in Resource? ~Basisgröße: : ~Basisgröße: */ + /* ### ACHTUNG: Neuer Text in Resource? ~Basisgr��e: : ~Basisgr��e: */ Text [ en-US ] = "Base ~size"; }; MetricField 1 @@ -246,7 +246,7 @@ ModalDialog RID_FONTSIZEDIALOG { Pos = MAP_APPFONT ( 6 , 24 ) ; Size = MAP_APPFONT ( 99 , 8 ) ; - /* ### ACHTUNG: Neuer Text in Resource? relative Größen : relative Größen */ + /* ### ACHTUNG: Neuer Text in Resource? relative Gr��en : relative Gr��en */ Text [ en-US ] = "Relative sizes" ; }; OKButton 1 @@ -433,7 +433,7 @@ ModalDialog RID_DISTANCEDIALOG SVLook = TRUE ; HelpID = SID_DISTANCE ; Size = MAP_APPFONT ( 240 , 90 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Abstände : Abstände */ + /* ### ACHTUNG: Neuer Text in Resource? Abst�nde : Abst�nde */ Text [ en-US ] = "Spacing" ; FixedText 1 { @@ -564,7 +564,7 @@ ModalDialog RID_DISTANCEDIALOG { String 1 { - /* ### ACHTUNG: Neuer Text in Resource? Abstände : Abstände */ + /* ### ACHTUNG: Neuer Text in Resource? Abst�nde : Abst�nde */ Text [ en-US ] = "Spacing" ; }; String 2 @@ -639,12 +639,12 @@ ModalDialog RID_DISTANCEDIALOG { String 1 { - /* ### ACHTUNG: Neuer Text in Resource? Brüche : Br³che */ + /* ### ACHTUNG: Neuer Text in Resource? Br�che : Br�che */ Text [ en-US ] = "Fractions" ; }; String 2 { - /* ### ACHTUNG: Neuer Text in Resource? ~Zählerhöhe: : ~Zählerhöhe: */ + /* ### ACHTUNG: Neuer Text in Resource? ~Z�hlerh�he: : ~Z�hlerh�he: */ Text [ en-US ] = "~Numerator"; }; Bitmap 20 @@ -676,7 +676,7 @@ ModalDialog RID_DISTANCEDIALOG }; String 2 { - /* ### ACHTUNG: Neuer Text in Resource? ~Überlänge: : ~šberlänge: */ + /* ### ACHTUNG: Neuer Text in Resource? ~�berl�nge: : ~�berl�nge: */ Text [ en-US ] = "~Excess length"; }; Bitmap 20 @@ -689,7 +689,7 @@ ModalDialog RID_DISTANCEDIALOG }; String 3 { - /* ### ACHTUNG: Neuer Text in Resource? ~Strichstärke: : ~Strichstärke: */ + /* ### ACHTUNG: Neuer Text in Resource? ~Strichst�rke: : ~Strichst�rke: */ Text [ en-US ] = "~Weight"; }; Bitmap 30 @@ -709,7 +709,7 @@ ModalDialog RID_DISTANCEDIALOG }; String 2 { - /* ### ACHTUNG: Neuer Text in Resource? Grenz~höhe: : Grenz~höhe: */ + /* ### ACHTUNG: Neuer Text in Resource? Grenz~h�he: : Grenz~h�he: */ Text [ en-US ] = "~Upper limit"; }; Bitmap 20 @@ -815,7 +815,7 @@ ModalDialog RID_DISTANCEDIALOG }; String 2 { - /* ### ACHTUNG: Neuer Text in Resource? ~Primärhöhe: : ~Primärhöhe: */ + /* ### ACHTUNG: Neuer Text in Resource? ~Prim�rh�he: : ~Prim�rh�he: */ Text [ en-US ] = "~Primary height"; }; Bitmap 20 @@ -847,7 +847,7 @@ ModalDialog RID_DISTANCEDIALOG }; String 2 { - /* ### ACHTUNG: Neuer Text in Resource? ~Übergröße: : ~šbergröße: */ + /* ### ACHTUNG: Neuer Text in Resource? ~�bergr��e: : ~�bergr��e: */ Text [ en-US ] = "~Excess size"; }; Bitmap 20 @@ -1127,7 +1127,7 @@ ModalDialog RID_SYMBOLDIALOG Pos = MAP_APPFONT ( 177 , 6 ) ; Size = MAP_APPFONT ( 56 , 14 ) ; DefButton = TRUE ; - /* ### ACHTUNG: Neuer Text in Resource? ~Übernehmen : ~šbernehmen */ + /* ### ACHTUNG: Neuer Text in Resource? ~�bernehmen : ~�bernehmen */ Text [ en-US ] = "~Insert" ; }; PushButton 3 @@ -1372,7 +1372,7 @@ QueryBox RID_DEFAULTSAVEQUERY { Buttons = WB_YES_NO ; DefButton = WB_DEF_YES ; - /* ### ACHTUNG: Neuer Text in Resource? Sollen die Änderungen als Standard gespeichert werden ?\n\nDiese Änderungen wirken sich auf alle neuen Formeln aus. : Sollen die Žnderungen als Standard gespeichert werden ?\n\nDiese Žnderungen wirken sich auf alle neuen Formeln aus. */ + /* ### ACHTUNG: Neuer Text in Resource? Sollen die �nderungen als Standard gespeichert werden ?\n\nDiese �nderungen wirken sich auf alle neuen Formeln aus. : Sollen die �nderungen als Standard gespeichert werden ?\n\nDiese �nderungen wirken sich auf alle neuen Formeln aus. */ Message [ en-US ] = "Should the changes be saved as defaults?\n\nThese changes will apply for all new formulas." ; }; @@ -1438,7 +1438,7 @@ Menu RID_VIEWMENU { Identifier = SID_ZOOMIN ; HelpID = SID_ZOOMIN ; - /* ### ACHTUNG: Neuer Text in Resource? Vergrößern : Vergrößern */ + /* ### ACHTUNG: Neuer Text in Resource? Vergr��ern : Vergr��ern */ Text [ en-US ] = "~Zoom In" ; }; MenuItem @@ -1759,7 +1759,7 @@ FloatingWindow RID_TOOLBOXWINDOW { Identifier = RID_XSIMEQY ; HelpId = HID_SMA_XSIMEQY ; - /* ### ACHTUNG: Neuer Text in Resource? ist ähnlich oder gleich : ist ähnlich oder glech */ + /* ### ACHTUNG: Neuer Text in Resource? ist �hnlich oder gleich : ist �hnlich oder glech */ Text [ en-US ] = "Is Similar Or Equal" ; }; ToolBoxItem @@ -1782,7 +1782,7 @@ FloatingWindow RID_TOOLBOXWINDOW { Identifier = RID_XLESLANTY ; HelpId = HID_SMA_XLESLANTY ; - /* ### ACHTUNG: Neuer Text in Resource? ist kleiner gleich (schräg) : ist keiner gleich */ + /* ### ACHTUNG: Neuer Text in Resource? ist kleiner gleich (schr�g) : ist keiner gleich */ Text [ en-US ] = "Is Less Than Or Equal To" ; }; ToolBoxItem @@ -2051,7 +2051,7 @@ FloatingWindow RID_TOOLBOXWINDOW { Identifier = RID_EX ; HelpId = HID_SMA_EX ; - /* ### ACHTUNG: Neuer Text in Resource? Exponentialfunktion : natürliche Exponentialfunktion */ + /* ### ACHTUNG: Neuer Text in Resource? Exponentialfunktion : nat�rliche Exponentialfunktion */ Text [ en-US ] = "Exponential Function" ; }; ToolBoxItem @@ -3456,13 +3456,13 @@ String RID_ERR_FUNCEXPECTED String RID_ERR_UNOPEREXPECTED { - /* ### ACHTUNG: Neuer Text in Resource? Unärer Operator erwartet : Un§rer Operator erwartet */ + /* ### ACHTUNG: Neuer Text in Resource? Un�rer Operator erwartet : Un�rer Operator erwartet */ Text [ en-US ] = "Unary operator expected" ; }; String RID_ERR_BINOPEREXPECTED { - /* ### ACHTUNG: Neuer Text in Resource? Binärer Operator erwartet : Bin§rer Operator erwartet */ + /* ### ACHTUNG: Neuer Text in Resource? Bin�rer Operator erwartet : Bin�rer Operator erwartet */ Text [ en-US ] = "Binary operator expected" ; }; @@ -3526,9 +3526,9 @@ ToolBox RID_MATH_TOOLBOX { Identifier = SID_ZOOMIN ; HelpID = SID_ZOOMIN ; - /* ### ACHTUNG: Neuer Text in Resource? Größer : Größer */ + /* ### ACHTUNG: Neuer Text in Resource? Gr��er : Gr��er */ Text [ en-US ] = "Zoom In" ; - /* ### ACHTUNG: Neuer Text in Resource? Stellt den Ausschnitt vergrößert dar : Stellt den Ausschnitt vergrößert dar */ + /* ### ACHTUNG: Neuer Text in Resource? Stellt den Ausschnitt vergr��ert dar : Stellt den Ausschnitt vergr��ert dar */ }; ToolBoxItem { @@ -3541,7 +3541,7 @@ ToolBox RID_MATH_TOOLBOX Identifier = SID_VIEW100 ; HelpID = SID_VIEW100 ; Text [ en-US ] = "Zoom 100%" ; - /* ### ACHTUNG: Neuer Text in Resource? Stellt den Ausschnitt in tatsächlicher Größe dar : Stellt den Ausschnitt in tatsächlicher GröÃe dar */ + /* ### ACHTUNG: Neuer Text in Resource? Stellt den Ausschnitt in tats�chlicher Gr��e dar : Stellt den Ausschnitt in tats�chlicher Gr��e dar */ }; ToolBoxItem { @@ -3570,7 +3570,7 @@ ToolBox RID_MATH_TOOLBOX Identifier = SID_SYMBOLS_CATALOGUE ; HelpID = SID_SYMBOLS_CATALOGUE ; Text [ en-US ] = "Symbols" ; - /* ### ACHTUNG: Neuer Text in Resource? Symbole einfügen und bearbeiten : Symbole einf³gen und bearbeiten */ + /* ### ACHTUNG: Neuer Text in Resource? Symbole einf�gen und bearbeiten : Symbole einf�gen und bearbeiten */ }; }; }; @@ -3602,6 +3602,7 @@ StringArray RID_PRINTUIOPTIONS < "Miscellaneous options"; >; < "Ig~nore ~~ and ` at the end of the line"; >; < "Specfies that these space wildcards will be removed if they are at the end of a line."; >; + < "%PRODUCTNAME %s"; >; }; }; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 03cea1d20e5f..54a4ae78207b 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -85,8 +85,8 @@ using namespace ::com::sun::star::script; SmPrintUIOptions::SmPrintUIOptions() { ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 15, "resource incomplete" ); - if( aLocalizedStrings.Count() < 15 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 19, "resource incomplete" ); + if( aLocalizedStrings.Count() < 19 ) // bad resource ? return; SmModule *pp = SM_MOD1(); @@ -101,7 +101,10 @@ SmPrintUIOptions::SmPrintUIOptions() // create Section for formula (results in an extra tab page in dialog) SvtModuleOptions aOpt; - m_aUIProperties[0].Value = getGroupControlOpt( aOpt.GetModuleName( SvtModuleOptions::E_SMATH ), rtl::OUString() ); + String aAppGroupname( aLocalizedStrings.GetString( 18 ) ); + aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), + aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) ); + m_aUIProperties[0].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); // create subgroup for print options m_aUIProperties[1].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index a13396da99b0..323c692948a3 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -246,7 +246,10 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create "writer" section (new tab page in dialog) SvtModuleOptions aOpt; - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aOpt.GetModuleName( SvtModuleOptions::E_SWRITER ), rtl::OUString() ); + String aAppGroupname( aLocalizedStrings.GetString( 54 ) ); + aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), + aOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); // create sub section for Contents m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); @@ -1300,7 +1303,7 @@ BOOL ViewShell::Prt( /* TLPDF neu: end */ - // benötigte Seiten fuers Drucken formatieren + // ben�tigte Seiten fuers Drucken formatieren pShell->CalcPagesForPrint( (USHORT)nPage, pProgress, pStr, nMergeAct, nMergeCnt ); diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 24692190abdf..19df21c5a26a 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -994,6 +994,7 @@ StringArray STR_PRINTOPTUI < "left and right pages"; >; < "left pages"; >; < "right pages"; >; + < "%PRODUCTNAME %s"; >; }; }; -- cgit v1.2.3 From 8baea37360aa2da89c0156c4d735df242a377dc4 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 1 Aug 2009 15:43:09 +0000 Subject: #i92518# lates UI changes --- starmath/source/smres.src | 2 +- sw/source/ui/config/optdlg.src | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/starmath/source/smres.src b/starmath/source/smres.src index bd87f9925b59..fdf6ce2a7462 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -3589,7 +3589,7 @@ StringArray RID_PRINTUIOPTIONS < "~Title row"; >; < "Specifies whether you want the name of the document to be included in the printout"; >; < "~Formula text"; >; - < "Specifies whether to include the contents of the Commands window at the bottom of the printout."; >; + < "Specifies whether to include the contents of the \"Commands\" window at the bottom of the printout."; >; < "B~order"; >; < "Applies a thin border to the formula area in the printout."; >; < "Print format"; >; diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 19df21c5a26a..103b5970decf 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -949,7 +949,7 @@ StringArray STR_PRINTOPTUI < "Specifies whether graphics created with %PRODUCTNAME drawing functions are printed."; >; < "Form control~s"; >; < "Specifies whether the form control fields of the text document are printed"; >; - < "Page Ba~ckground"; >; + < "Page ba~ckground"; >; < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; < "Print text in blac~k"; >; < "Specifies whether to always print text in black."; >; -- cgit v1.2.3 From 79a0372102d3804b2917b089cf087403b0a1c041 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 1 Aug 2009 15:58:08 +0000 Subject: #i92518# lates UI changes --- sw/source/ui/config/optdlg.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 103b5970decf..a329decc41cc 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -974,7 +974,7 @@ StringArray STR_PRINTOPTUI < "Select the Brochure option to print the document in brochure format."; >; < "Right to Left"; >; < "Check to print the pages of the brochure in the correct order for a right-to-left script."; >; - < "Other"; >; + < "Pages"; >; < "Print ~automatically inserted blank pages"; >; < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; < "~Paper tray from printer settings"; >; -- cgit v1.2.3 From 9318ceab8acced650a36d7e0e13720c01645ba13 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 3 Aug 2009 15:15:11 +0000 Subject: #i92518# latest fashion updates --- sw/source/core/view/vprint.cxx | 17 ++++++++++------- sw/source/ui/config/optdlg.src | 2 ++ sw/source/ui/uno/unotxdoc.cxx | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 323c692948a3..b2a2ba26e357 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -240,7 +240,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create sequence of print UI options // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 18 : 21; + const int nNumProps = bWeb? 17 : 20; m_aUIProperties.realloc( nNumProps ); int nIdx = 0; @@ -369,14 +369,17 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : ); // create a bool option for brochure RTL dependent on brochure + uno::Sequence< rtl::OUString > aBRTLChoices( 3 ); + aBRTLChoices[0] = aLocalizedStrings.GetString( 55 ); + aBRTLChoices[1] = aLocalizedStrings.GetString( 56 ); vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 32 ), - aLocalizedStrings.GetString( 33 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), - sal_False, - aBrochureRTLOpt - ); + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), + uno::Sequence< rtl::OUString >(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), + aBRTLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aBrochureRTLOpt + ); // print range selection vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index a329decc41cc..d6456f69d2a6 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -995,6 +995,8 @@ StringArray STR_PRINTOPTUI < "left pages"; >; < "right pages"; >; < "%PRODUCTNAME %s"; >; + < "Left-to-right script"; >; + < "Right-to-left script"; >; }; }; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 027b787db29d..0f4865fbf85c 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2887,7 +2887,7 @@ void SAL_CALL SwXTextDocument::render( aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( C2U( "PaperTray" ), aOptions.bPaperFromSetup ); aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( C2U( "PrintReverseOrder" ), aOptions.bPrintReverse ); aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), aOptions.bPrintProspect ); - aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochureRTL" ), aOptions.bPrintProspect_RTL ); + aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( C2U( "PrintBrochureRTL" ), aOptions.bPrintProspect_RTL ) ? true : false; // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( C2U( "PrintBlack" ), aOptions.bPrintBlackFont ); -- cgit v1.2.3 From 89b70cad0e882861714d7a158c21a1fceca921a1 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 4 Aug 2009 09:27:27 +0000 Subject: #i103991# fixed crash --- sw/inc/rolbck.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sw/inc/rolbck.hxx b/sw/inc/rolbck.hxx index 6dd6a90ad640..63bd174830af 100644 --- a/sw/inc/rolbck.hxx +++ b/sw/inc/rolbck.hxx @@ -160,8 +160,11 @@ public: class SwHistorySetTxtFld : public SwHistoryHint { - const ::std::auto_ptr m_pFld; + //!! beware of the order for the declation of thje auto_ptrs. + //!! If they get destroyed in the wrong order sw may crash (namely mail-merge as well) ::std::auto_ptr m_pFldType; + const ::std::auto_ptr m_pFld; + ULONG m_nNodeIndex; xub_StrLen m_nPos; USHORT m_nFldWhich; -- cgit v1.2.3 From c195e304f8df070971e77038a17ea3e09f1fbd36 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 4 Aug 2009 12:13:41 +0000 Subject: #i101242# new print UI --- sw/inc/dbfld.hxx | 1 + sw/inc/doc.hxx | 2 +- sw/inc/swprtopt.hxx | 21 ++++------------ sw/source/core/doc/doc.cxx | 20 ++++++++++++---- sw/source/core/fields/dbfld.cxx | 4 ++++ sw/source/core/view/vprint.cxx | 6 ++--- sw/source/ui/uno/unotxdoc.cxx | 53 +++++++++++++++++++++++++---------------- 7 files changed, 60 insertions(+), 47 deletions(-) diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx index 9b61f001ed12..9adb2eb688a5 100644 --- a/sw/inc/dbfld.hxx +++ b/sw/inc/dbfld.hxx @@ -52,6 +52,7 @@ class SW_DLLPUBLIC SwDBFieldType : public SwValueFieldType public: SwDBFieldType(SwDoc* pDocPtr, const String& rColumnName, const SwDBData& rDBData); + ~SwDBFieldType(); virtual const String& GetName() const; virtual SwFieldType* Copy() const; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 98aabe79c01a..d0d18f1043b7 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1335,7 +1335,7 @@ public: // get the set of printable pages for the XRenderable API by // evaluating the respective settings (see implementation) - void GetValidPagesForPrinting( SwPrintUIOptions &rPrintUIOptions, + void GetValidPagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, sal_Int32 nDocPageCount ); sal_uInt16 GetPageCount() const; diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index b8a48d678f1a..741e2d7618f8 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -115,9 +115,10 @@ public: typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; - std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } - ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } - const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } + std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } + const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } + ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } + const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } bool isPrintLeftPages() const; @@ -127,17 +128,3 @@ public: #endif //_SWPRTOPT_HXX - - - - - - - - - - - - - - diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 9a4f94c9de80..8c4ff026876b 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -991,6 +991,7 @@ const SwDocStat& SwDoc::GetDocStat() const void SwDoc::GetValidPagesForPrinting( + bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, sal_Int32 nDocPageCount ) { @@ -999,10 +1000,21 @@ void SwDoc::GetValidPagesForPrinting( return; // properties to take into account when calcualting the set of pages - const bool bPrintLeftPage = rPrintUIOptions.isPrintLeftPages(); - const bool bPrintRightPage = rPrintUIOptions.isPrintRightPages(); - const bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - const bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); + bool bPrintLeftPage = rPrintUIOptions.isPrintLeftPages(); + bool bPrintRightPage = rPrintUIOptions.isPrintRightPages(); + bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); + + if (bIsPDFExport) + { + // PDF export UI does not allow for selecting left or right pages only or reverse print + bPrintLeftPage = true; + bPrintRightPage = true; + bPrintReverse = false; + // TLPDF, TODO; take care of the option 'Export automatically inserted blank pages' + // from the 'Export as PDF' (aka PDF Options) dialog. + bPrintEmptyPages = false; + } Range aPages( 1, nDocPageCount ); diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 996f3b092313..b59eb29a8192 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -96,6 +96,10 @@ SwDBFieldType::SwDBFieldType(SwDoc* pDocPtr, const String& rNam, const SwDBData& sName += GetColumnName(); } //------------------------------------------------------------------------------ +SwDBFieldType::~SwDBFieldType() +{ +} +//------------------------------------------------------------------------------ SwFieldType* SwDBFieldType::Copy() const { diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index b2a2ba26e357..35caadbd1855 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1291,13 +1291,11 @@ BOOL ViewShell::Prt( /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer <= sal_Int32(rPrintUIOptions.GetPagesToPrint().size()), - "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintUIOptions.GetPagesToPrint().size(), "nRenderer out of bounds"); #endif const sal_Int32 nPage = rPrintUIOptions.GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nPage && nPage <= sal_Int32(rPrintUIOptions.GetValidStartFrms().size()), - "nPage out of bounds"); + DBG_ASSERT( rPrintUIOptions.GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 0f4865fbf85c..d6360c22be86 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2655,30 +2655,44 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } const sal_Int32 nPageCount = pDoc->GetPageCount(); + OUString aPageRange; if (bIsPDFExport) - nRet = nPageCount; - else { - OUString aPageRange = m_pPrintUIOptions->getStringValue( C2U( "PageRange" ), OUString() ); - if (aPageRange.getLength() == 0) +// uno::Any aSelection; + for( sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i ) { - // set page range to print all pages - aPageRange = OUString::valueOf( (sal_Int32)1 ); - aPageRange += OUString::valueOf( (sal_Unicode)'-'); - aPageRange += OUString::valueOf( nPageCount ); + if( rxOptions[ i ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) + rxOptions[ i ].Value >>= aPageRange; +// else if( rxOptions[ i ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) ) ) +// rxOptions[ i ].Value >>= aSelection; } + } + else + { + aPageRange = m_pPrintUIOptions->getStringValue( C2U( "PageRange" ), OUString() ); + } - // get set of valid pages (according to the current settings) - // and their start frames - pDoc->GetValidPagesForPrinting( *m_pPrintUIOptions, nPageCount ); + if (aPageRange.getLength() == 0) + { + // set page range to print to 'all pages' + aPageRange = OUString::valueOf( (sal_Int32)1 ); + aPageRange += OUString::valueOf( (sal_Unicode)'-'); + aPageRange += OUString::valueOf( nPageCount ); + } - // get vector of pages to print according to PageRange and valid pages from above - StringRangeEnumerator::getRangesFromString( - aPageRange, m_pPrintUIOptions->GetPagesToPrint(), - 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + // get set of valid pages (according to the current settings) + // and their start frames + pDoc->GetValidPagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); + DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); - nRet = m_pPrintUIOptions->GetPagesToPrint().size(); - } + // get vector of pages to print according to PageRange and valid pages from above + // (result may be an empty vector, for example if the range string is not correct) + StringRangeEnumerator::getRangesFromString( + aPageRange, m_pPrintUIOptions->GetPagesToPrint(), + 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + + nRet = m_pPrintUIOptions->GetPagesToPrint().size(); + DBG_ASSERT( nRet >= 0, "negative number of pages???" ); return nRet; } @@ -2816,10 +2830,7 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - const sal_Int32 nMaxCount = bIsPDFExport? - static_cast< sal_Int32 >(pDoc->GetPageCount()) : - static_cast< sal_Int32 >(m_pPrintUIOptions->GetPagesToPrint().size()); - if (nRenderer >= nMaxCount) + if (nRenderer >= m_pPrintUIOptions->GetPagesToPrint().size()) return; // the view shell should be SwView for documents PDF export -- cgit v1.2.3 From 1b4b6cfb19e8e73c804ac394394311581a4618c9 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 4 Aug 2009 16:15:36 +0000 Subject: fix warnings --- sw/source/core/undo/rolbck.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index aee144900959..ec62ab78de79 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -271,8 +271,8 @@ void SwHistorySetTxt::SetInDoc( SwDoc* pDoc, bool ) SwHistorySetTxtFld::SwHistorySetTxtFld( SwTxtFld* pTxtFld, ULONG nNodePos ) : SwHistoryHint( HSTRY_SETTXTFLDHNT ) - , m_pFld( new SwFmtFld( *pTxtFld->GetFld().GetFld() ) ) , m_pFldType( 0 ) + , m_pFld( new SwFmtFld( *pTxtFld->GetFld().GetFld() ) ) { // only copy if not Sys-FieldType SwDoc* pDoc = pTxtFld->GetTxtNode().GetDoc(); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index d6360c22be86..ba7f79d681a8 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2830,7 +2830,7 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if (nRenderer >= m_pPrintUIOptions->GetPagesToPrint().size()) + if (nRenderer >= sal_Int32(m_pPrintUIOptions->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export -- cgit v1.2.3 From 063c55820f1f7b21f2999d9a5f8a0e18078c3f32 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 6 Aug 2009 12:40:39 +0000 Subject: #i92516# Fix mail merge with new printing function. Don't set SID_ASYNCHRON to true for normal mail merge operations --- sw/inc/dbmgr.hxx | 2 +- sw/source/ui/dbui/dbmgr.cxx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index 0c359bd05cdb..9e13058e90e6 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -184,7 +184,7 @@ struct SwMergeDescriptor rDescriptor(rDesc), bSendAsHTML( sal_True ), bSendAsAttachment( sal_False ), - bPrintAsync( sal_True ), + bPrintAsync( sal_False ), bCreateSingleFile( sal_False ), pMailMergeConfigItem(0) {} diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 7fa9a24338c2..97d882c3a8e1 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -500,12 +500,11 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) if(IsMergeSilent()) { aPrintArgs.Put( SfxBoolItem(SID_SILENT, TRUE) ); - // #i25686# printing should be done asynchronously to prevent dangling offices - // when mail merge is called as command line macro - // #i52629# aynchronous printing should only be done in silent mode - otherwise - // the printer dialog does not come up - aPrintArgs.Put( SfxBoolItem( SID_ASYNCHRON, rMergeDesc.bPrintAsync )); } + // #i52629# aynchronous printing should only be done in silent mode - otherwise + // the printer dialog does not come up + aPrintArgs.Put( SfxBoolItem( SID_ASYNCHRON, rMergeDesc.bPrintAsync )); + // convert PropertyValues const beans::PropertyValue* pPrintOptions = rMergeDesc.aPrintOptions.getConstArray(); for( sal_Int32 nOption = 0; nOption < rMergeDesc.aPrintOptions.getLength(); ++nOption) -- cgit v1.2.3 From 278729a448d7e56c426229325a960f08c38fafbc Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 7 Aug 2009 14:42:45 +0000 Subject: #i103991# prospect printing --- sw/inc/doc.hxx | 4 +- sw/inc/swprtopt.hxx | 22 +++++- sw/inc/viewsh.hxx | 15 ++-- sw/source/core/doc/doc.cxx | 166 ++++++++++++++++++++++++++++++++++++++++- sw/source/core/view/viewpg.cxx | 129 +++++++++++++++++++++++++------- sw/source/core/view/vprint.cxx | 30 ++------ sw/source/ui/uno/unotxdoc.cxx | 46 ++++++++---- 7 files changed, 333 insertions(+), 79 deletions(-) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index d0d18f1043b7..2b1937f2912e 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1335,7 +1335,9 @@ public: // get the set of printable pages for the XRenderable API by // evaluating the respective settings (see implementation) - void GetValidPagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, + void CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, + sal_Int32 nDocPageCount ); + void CalculatePagePairsForProspectPrinting( SwPrintUIOptions &rPrintUIOptions, sal_Int32 nDocPageCount ); sal_uInt16 GetPageCount() const; diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index 741e2d7618f8..53b00bff4f07 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -38,6 +38,7 @@ #include #include #include +#include #define POSTITS_NONE 0 #define POSTITS_ONLY 1 @@ -99,8 +100,9 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper { OutputDevice* mpLast; - // pages valid for printing (accoridng to the current settings) + // pages valid for printing (according to the current settings) // and their respective start frames (see getRendererCount in unotxdoc.cxx) + // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages @@ -108,21 +110,33 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper // (see 'render' in unotxdoc.cxx) std::vector< sal_Int32 > aPagesToPrint; + // for prospect printing: the pairs of pages to be printed together on a single prospect page. + // -1 indicates a half page to be left empty. + std::vector< std::pair< sal_Int32, sal_Int32 > > aPagePairs; + public: SwPrintUIOptions( BOOL bWeb ); bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); - typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; + typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; + typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } + + // used for 'normal' printing std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } - bool isPrintLeftPages() const; - bool isPrintRightPages() const; + + // used for prospect printing only + PagePairsVec_t & GetPagePairsForProspectPrinting() { return aPagePairs; } + const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return aPagePairs; } + + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; }; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index dbbeec0e7d8e..007fc7c05ed3 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -365,9 +365,15 @@ public: //Druckauftrag abwickeln. // bIsPDFExport == true is: do PDF Export (no printing!) - sal_Bool Prt( OutputDevice* pOutDev, SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, sal_Int32 nRenderer /* offset in vector of pages to print */, - SfxProgress* pProgress, bool bIsPDFExport = false ); + sal_Bool PrintOrPDFExport( OutputDevice* pOutDev, SwPrtOptions& rOptions, + const SwPrintUIOptions &rPrintUIOptions, + sal_Int32 nRenderer, /* offset in vector of pages to print */ + bool bIsPDFExport = sal_False ); + + // Prospekt-Format drucken + void PrintProspect( OutputDevice* pOutDev, SwPrtOptions& rOptions, + const SwPrintUIOptions &rPrintUIOptions, + sal_Int32 nRenderer /* offset in vector of page pairs for prospect */ ); //"Drucken" fuer OLE 2.0 static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, @@ -483,9 +489,6 @@ public: SfxProgress& rProgress, const SwPagePreViewPrtData* = 0 ); - // Prospekt-Format drucken - void PrintProspect( SwPrtOptions&, SfxProgress& , BOOL bRTL); - sal_Bool IsViewLocked() const { return bViewLocked; } void LockView( sal_Bool b ) { bViewLocked = b; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 8c4ff026876b..681af392f2dd 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -990,7 +991,7 @@ const SwDocStat& SwDoc::GetDocStat() const } -void SwDoc::GetValidPagesForPrinting( +void SwDoc::CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, sal_Int32 nDocPageCount ) @@ -1000,8 +1001,9 @@ void SwDoc::GetValidPagesForPrinting( return; // properties to take into account when calcualting the set of pages - bool bPrintLeftPage = rPrintUIOptions.isPrintLeftPages(); - bool bPrintRightPage = rPrintUIOptions.isPrintRightPages(); + bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); + bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); + // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); @@ -1123,6 +1125,164 @@ void SwDoc::GetValidPagesForPrinting( } +void SwDoc::CalculatePagePairsForProspectPrinting( + SwPrintUIOptions &rPrintUIOptions, + sal_Int32 nDocPageCount ) +{ + std::set< sal_Int32 > &rValidPagesSet = rPrintUIOptions.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rPrintUIOptions.GetValidStartFrms(); + std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rPrintUIOptions.GetPagePairsForProspectPrinting(); + + rPagePairs.clear(); + rValidPagesSet.clear(); + rValidStartFrms.clear(); + + rtl::OUString aPageRange = rPrintUIOptions.getStringValue( C2U( "PageRange" ), rtl::OUString() ); + StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 ); + + DBG_ASSERT( pLayout, "no layout present" ); + if (!pLayout || aRange.size() <= 0) + return; + + const SwPageFrm *pStPage = (SwPageFrm*)pLayout->Lower(); + sal_Int32 i = 0; + for ( i = 1; pStPage && i < nDocPageCount; ++i ) + pStPage = (SwPageFrm*)pStPage->GetNext(); + if ( !pStPage ) // dann wars das + return; + + // currently for prospect printing all pages are valid to be printed + // thus we add them all to the respective map and set for later use + sal_Int32 nPageNum = 0; + const SwPageFrm *pPageFrm = (SwPageFrm*)pLayout->Lower(); + while( pPageFrm && nPageNum < nDocPageCount ) + { + DBG_ASSERT( pPageFrm, "Empty page frame. How are we gpoing to print this?" ); + ++nPageNum; + rValidPagesSet.insert( nPageNum ); + rValidStartFrms[ nPageNum ] = pPageFrm; + pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); + } + DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" ); + + // properties to take into account when calcualting the set of pages + // Note: here bPrintLeftPage and bPrintRightPage refer to the (virtual) resulting pages + // of the prospect! + bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); + bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); + // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now + bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); + bool bPrintProspect_RTL = rPrintUIOptions.getIntValue( C2U( "PrintBrochureRTL" ), 0 ) ? true : false; + + // get pages for prospect printing according to the 'PageRange' + // (duplicates and any order allowed!) + std::vector< sal_Int32 > aPagesToPrint; + StringRangeEnumerator::getRangesFromString( + aPageRange, aPagesToPrint, 1, nDocPageCount, 0 ); + + // now fill the vector for calculating the page pairs with the start frames + // from the above obtained vector + std::vector< const SwPageFrm * > aVec; + for (sal_Int32 i = 0; i < aPagesToPrint.size(); ++i) + { + const sal_Int32 nPage = aPagesToPrint[i]; + const SwPageFrm *pFrm = rValidStartFrms[ nPage ]; + aVec.push_back( pFrm ); + } + + // auf Doppelseiten auffuellen + if ( 1 == aVec.size() ) // eine Seite ist ein Sonderfall + aVec.insert( aVec.begin() + 1, 0 ); + else + { + while( aVec.size() & 3 ) + aVec.push_back( 0 ); + + if ( bPrintReverse && 4 < aVec.size() ) + { + // das Array umsortieren + // Array: 1 2 3 4 5 6 7 8 + // soll: 3 4 1 2 7 8 5 6 + // Algorhitmus: + // vordere Haelfte: Austausch von 2 Pointer von Vorne vor die Haelfte + // hintere Haelfte: Austausch von 2 Pointer von der Haelfte nach hinten + + USHORT nHalf = aVec.size() / 2; + USHORT nSwapCount = nHalf / 4; + + const SwPageFrm ** ppArrStt = &aVec[ 0 ]; + const SwPageFrm ** ppArrHalf = &aVec[ nHalf ]; + + for ( int k = 0; k < 2; ++k ) + { + for ( USHORT n = 0; n < nSwapCount; ++n ) + { + const SwPageFrm * pTmp = *ppArrStt; + *ppArrStt++ = *(ppArrHalf-2); + *(ppArrHalf-2) = pTmp; + + pTmp = *ppArrStt; + *ppArrStt++ = *--ppArrHalf; + *ppArrHalf-- = pTmp; + } + ppArrStt = &aVec[ nHalf ]; + ppArrHalf = &aVec[ 0 ] + aVec.size(); + } + } + } + + // dann sorge mal dafuer, das alle Seiten in der richtigen + // Reihenfolge stehen: + USHORT nSPg = 0, nEPg = aVec.size(), nStep = 1; + if ( 0 == (nEPg & 1 )) // ungerade gibt es nicht! + --nEPg; + + if ( !bPrintLeftPage ) + ++nStep; + else if ( !bPrintRightPage ) + { + ++nStep; + ++nSPg, --nEPg; + } + + sal_Int32 nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1; + DBG_ASSERT( nCntPage * 2 == aVec.size(), "vector size vs. page count mismatch" ); + + for ( USHORT nPrintCount = 0; nSPg < nEPg && + nPrintCount < nCntPage; ++nPrintCount ) + { + pStPage = aVec[ nSPg ]; + const SwPageFrm* pNxtPage = nEPg < aVec.size() ? aVec[ nEPg ] : 0; + + short nRtlOfs = bPrintProspect_RTL ? 1 : 0; + if ( 0 == (( nSPg + nRtlOfs) & 1 ) ) // switch for odd number in LTR, even number in RTL + { + const SwPageFrm* pTmp = pStPage; + pStPage = pNxtPage; + pNxtPage = pTmp; + } + + sal_Int32 nFirst, nSecond = -1; + for ( int nC = 0; nC < 2; ++nC ) + { + sal_Int32 nPageNum = -1; + if ( pStPage ) + nPageNum = pStPage->GetPhyPageNum(); + if (nC == 0) + nFirst = nPageNum; + else + nSecond = nPageNum; + + pStPage = pNxtPage; + } + rPagePairs.push_back( std::pair< sal_Int32, sal_Int32 >(nFirst, nSecond) ); + + nSPg = nSPg + nStep; + nEPg = nEPg - nStep; + } + DBG_ASSERT( nCntPage == rPagePairs.size(), "size mismatch for number of page pairs" ); +} sal_uInt16 SwDoc::GetPageCount() const diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 7051b58aa1dd..49ec9bb483b3 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -413,7 +413,7 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, SwPaintQueue::Repaint(); memset( aPageArr, 0, sizeof( SwPageFrm* ) * nPages ); - nCntPage = 0; + nCntPage = 0; nMaxRowSz = nMaxColSz = nCalcH = nCalcW = 0; } } @@ -450,18 +450,44 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, // print brochure // OD 05.05.2003 #i14016# - consider empty pages on calculation of the scaling // for a page to be printed. -void ViewShell::PrintProspect( SwPrtOptions& rOptions, - SfxProgress& rProgress , BOOL bRTL) +void ViewShell::PrintProspect( + OutputDevice* pOutDev, + SwPrtOptions& rOptions, + const SwPrintUIOptions & rPrintUIOptions, /* TLPDF keep this or the above? */ + sal_Int32 nRenderer ) { - if( !rOptions.aMulti.GetSelectCount() ) +// TLPDF if( !rOptions.aMulti.GetSelectCount() ) + Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); + if (!pPrinter || rPrintUIOptions.GetPagePairsForProspectPrinting().size() <= 0) return; +#ifdef TL_NOT_NOW /*TLPDF*/ // wenn kein Drucker vorhanden ist, wird nicht gedruckt SfxPrinter* pPrt = getIDocumentDeviceAccess()->getPrinter(false); if( !pPrt || !pPrt->GetName().Len() || ( !rOptions.bPrintLeftPage && !rOptions.bPrintRightPage )) return; +#endif // TL_NOT_NOW /*TLPDF*/ + + // save settings of OutputDevice (should be done always now since the + // output device is now provided by a call from outside the Writer) + pPrinter->Push(); + +/* TLPDF neu: start */ +#if OSL_DEBUG_LEVEL > 1 + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintUIOptions.GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); +#endif + std::pair< sal_Int32, sal_Int32 > rPagesToPrint = + rPrintUIOptions.GetPagePairsForProspectPrinting()[ nRenderer ]; + const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? + rPagesToPrint.first : rPagesToPrint.second); +#if OSL_DEBUG_LEVEL > 1 + DBG_ASSERT( rPagesToPrint.first == -1 || rPrintUIOptions.GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); + DBG_ASSERT( rPagesToPrint.second == -1 || rPrintUIOptions.GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); +#endif +/* TLPDF neu: end */ +#ifdef TL_NOT_NOW /*TLPDF*/ MultiSelection aMulti( rOptions.aMulti ); Range aPages( aMulti.FirstSelected(), aMulti.LastSelected() ); if ( aPages.Max() > USHRT_MAX ) @@ -471,11 +497,15 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, "Seite 0 Drucken?" ); ASSERT( aPages.Min() <= aPages.Max(), "MinSeite groesser MaxSeite." ); +#endif // TL_NOT_NOW /*TLPDF*/ // eine neue Shell fuer den Printer erzeugen - ViewShell aShell( *this, 0 ); +// TLPDF ViewShell aShell( *this, 0 ); + ViewShell aShell( *this, 0, pPrinter ); +#ifdef TL_NOT_NOW /*TLPDF*/ if ( &GetRefDev() == pPrt ) aShell.mpTmpRef = new SfxPrinter( *pPrt ); +#endif // TL_NOT_NOW /*TLPDF*/ SET_CURR_SHELL( &aShell ); @@ -497,8 +527,9 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, } // Seiten fuers Drucken formatieren - aShell.CalcPagesForPrint( (USHORT)aPages.Max(), &rProgress ); + aShell.CalcPagesForPrint( nPageMax, 0 /*(USHORT)aPages.Max(), &rProgress*/ ); +#ifdef TL_NOT_NOW /*TLPDF*/ USHORT nCopyCnt = rOptions.bCollate ? rOptions.nCopyCount : 1; const SwPageFrm *pStPage = (SwPageFrm*)GetLayout()->Lower(); @@ -506,23 +537,30 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, for( i = 1; pStPage && i < (USHORT)aPages.Min(); ++i ) pStPage = (SwPageFrm*)pStPage->GetNext(); +#endif // TL_NOT_NOW /*TLPDF*/ - if( !pStPage ) // dann wars das +#ifdef TL_NOT_NOW /*TLPDF*/ + should not happen any more since the test + rPrintUIOptions.GetPagePairsForProspectPrinting().size() <= 0 + above should have taken care that there is at least one page to print + if( !pStPage ) // dann wars das { if( bHiddenFlds ) { SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( (USHORT)aPages.Max() ); + CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); } return; } +#endif // TL_NOT_NOW /*TLPDF*/ +#ifdef TL_NOT_NOW /*TLPDF*/ // unsere SttPage haben wir, dann die EndPage suchen SvPtrarr aArr( 255, 255 ); aArr.Insert( (void*)pStPage, aArr.Count() ); - while( pStPage->GetNext() && i < (USHORT)aPages.Max() ) + while( pStPage->GetNext() && i < nPageMax (USHORT)aPages.Max() ) { pStPage = (SwPageFrm*)pStPage->GetNext(); if( aMulti.IsSelected( ++i ) ) @@ -569,17 +607,17 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, } } } +#endif // TL_NOT_NOW /*TLPDF*/ - BOOL bStartJob = FALSE; +//TLPDF BOOL bStartJob = FALSE; - for( USHORT nCnt = 0; nCnt < nCopyCnt; nCnt++ ) + for( USHORT nCnt = 0; nCnt <= 0 /*< 1 TLPDF nCopyCnt*/; nCnt++ ) { +#ifdef TL_NOT_NOW /*TLPDF*/ if( rOptions.IsPrintSingleJobs() && rOptions.GetJobName().Len() && ( bStartJob || rOptions.bJobStartet ) ) { -#ifdef TL_NOT_NOW /*TLPDF*/ pPrt->EndJob(); -#endif rOptions.bJobStartet = TRUE; // Reschedule statt Yield, da Yield keine Events abarbeitet @@ -607,31 +645,55 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, } USHORT nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1; +#endif // TL_NOT_NOW /*TLPDF*/ - MapMode aOld( pPrt->GetMapMode() ); + MapMode aOld( /*TLPDF pPrt*/pPrinter->GetMapMode() ); MapMode aMapMode( MAP_TWIP ); - Size aPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode ) ); +// TLPDF Size aPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode ) ); + Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ +#ifdef TL_NOT_NOW /*TLPDF*/ const XubString aTmp( SW_RES( STR_STATSTR_PRINT ) ); rProgress.SetText( aTmp ); //HACK, damit die Anzeige nicht durcheinander kommt: rProgress.SetState( 1, nCntPage ); rProgress.SetText( aTmp ); +#endif // TL_NOT_NOW /*TLPDF*/ - for( USHORT nPrintCount = 0; nSPg < nEPg && - nPrintCount < nCntPage; ++nPrintCount ) + for( USHORT nPrintCount = 0; nPrintCount <= 0 /*nSPg < nEPg && nPrintCount < nCntPage*/; ++nPrintCount ) { +#ifdef TL_NOT_NOW /*TLPDF*/ // Mag der Anwender noch ? rProgress.Reschedule(); if ( !pPrt->IsJobActive() ) break; - SwTwips nMaxRowSz, nMaxColSz; pStPage = (SwPageFrm*)aArr[ nSPg ]; const SwPageFrm* pNxtPage = nEPg < aArr.Count() ? (SwPageFrm*)aArr[ nEPg ] : 0; +#endif // TL_NOT_NOW /*TLPDF*/ + + SwTwips nMaxRowSz, nMaxColSz; + +/* TLPDF neu: start */ + const SwPageFrm *pStPage = 0; + const SwPageFrm *pNxtPage = 0; + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); + if (rPagesToPrint.first > 0) + { + SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + pStPage = aIt->second; + } + if (rPagesToPrint.second > 0) + { + SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.second ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + pNxtPage = aIt->second; + } +/* TLPDF neu: end */ // OD 05.05.2003 #i14016# - consider empty pages on calculation // of page size, used for calculation of scaling. @@ -684,6 +746,7 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, aSttPageSize.Height() ); } +#ifdef TL_NOT_NOW /*TLPDF*/ short nRtlOfs = bRTL ? 1 : 0; if( 0 == (( nSPg + nRtlOfs) & 1 ) ) // switch for odd number in LTR, even number in RTL { @@ -691,6 +754,7 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, pStPage = pNxtPage; pNxtPage = pTmp; } +#endif // TL_NOT_NOW /*TLPDF*/ // den MapMode einstellen aMapMode.SetOrigin( Point() ); @@ -716,14 +780,14 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, aMapMode.SetScaleX( aScY ); } - Point aPrtOff( pPrt->PixelToLogic( - pPrt->GetPageOffsetPixel(), aMapMode ) ); - Size aTmpPrtSize( pPrt->PixelToLogic( - pPrt->GetPaperSizePixel(), aMapMode ) ); +// TLPDF Point aPrtOff( pPrt->PixelToLogic( pPrt->GetPageOffsetPixel(), aMapMode ) ); +// TLPDF Size aTmpPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode ) ); + Point aPrtOff( pPrinter->PixelToLogic( pPrinter->GetPageOffsetPixel(), aMapMode ) ); /* TLPDF */ + Size aTmpPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ // dann kann das drucken losgehen - bStartJob = TRUE; - rProgress.SetState( nPrintCount, nCntPage ); +//TLPDF bStartJob = TRUE; +//TLPDF rProgress.SetState( nPrintCount, nCntPage ); #ifdef TL_NOT_NOW /*TLPDF*/ pPrt->StartPage(); @@ -741,7 +805,7 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, aPos -= aShell.aVisArea.Pos(); aPos -= aPrtOff; aMapMode.SetOrigin( aPos ); - pPrt->SetMapMode( aMapMode ); + pPrinter->SetMapMode( aMapMode ); pStPage->GetUpper()->Paint( pStPage->Frm() ); } @@ -753,20 +817,31 @@ void ViewShell::PrintProspect( SwPrtOptions& rOptions, pPrt->EndPage(); #endif SwPaintQueue::Repaint(); + +#ifdef TL_NOT_NOW /*TLPDF*/ nSPg = nSPg + nStep; nEPg = nEPg - nStep; +#endif // TL_NOT_NOW /*TLPDF*/ } - pPrt->SetMapMode( aOld ); + pPrinter->SetMapMode( aOld ); if( bHiddenFlds ) { SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( (USHORT)aPages.Max() ); + CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); } +#ifdef TL_NOT_NOW /*TLPDF*/ if( bStartJob ) rOptions.bJobStartet = TRUE; +#endif // TL_NOT_NOW /*TLPDF*/ } pFntCache->Flush(); + + // restore settings of OutputDevice (should be done always now since the + // output device is now provided by a call from outside the Writer) + pPrinter->Pop(); } + + diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 35caadbd1855..e4083016131a 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -418,13 +418,13 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } -bool SwPrintUIOptions::isPrintLeftPages() const +bool SwPrintUIOptions::IsPrintLeftPages() const { sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); return nLRPages == 0 || nLRPages == 1; } -bool SwPrintUIOptions::isPrintRightPages() const +bool SwPrintUIOptions::IsPrintRightPages() const { sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); return nLRPages == 0 || nLRPages == 2; @@ -890,14 +890,6 @@ void ViewShell::ChgAllPageSize( Size &rSz ) } } -/****************************************************************************** - * Methode : void ViewShell::CalcPagesForPrint( short nMax, BOOL ... - * Beschreibung: - * Erstellt : OK 04.11.94 15:33 - * Aenderung : MA 07. Jun. 95 - ******************************************************************************/ - - void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, const XubString *pStr, ULONG nAct, ULONG nCnt, ULONG nOffs, ULONG nPageNo ) @@ -1179,24 +1171,16 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) return pPrtDoc; } -/****************************************************************************** - * Methode : void ViewShell::Prt - * Beschreibung: - * Erstellt : OK 04.11.94 15:33 - * Aenderung : MA 10. May. 95 - ******************************************************************************/ - -BOOL ViewShell::Prt( +sal_Bool ViewShell::PrintOrPDFExport( OutputDevice* pOutDev, SwPrtOptions& rOptions, const SwPrintUIOptions &rPrintUIOptions, /* TLPDF keep this or the above? */ sal_Int32 nRenderer, - SfxProgress* pProgress, /* TLPDF superfluous ??? */ bool bIsPDFExport ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -//Immer die Druckroutine in viewpg.cxx (fuer Seitenvorschau) mitpflegen!! +//Immer die Druckroutinen in viewpg.cxx (PrintPreViewPage und PrintProspect) mitpflegen!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BOOL bStartJob = FALSE; @@ -1209,7 +1193,7 @@ BOOL ViewShell::Prt( // TLPDF: this one should hold just one page now. Thus clean-up should be possible MultiSelection aMulti( rOptions.aMulti ); - if ( !aMulti.GetSelectCount() ) + if ( !pOutDev || !aMulti.GetSelectCount() ) return bStartJob; // save settings of OutputDevice (should be done always now since the @@ -1305,7 +1289,7 @@ BOOL ViewShell::Prt( // ben�tigte Seiten fuers Drucken formatieren - pShell->CalcPagesForPrint( (USHORT)nPage, pProgress, pStr, + pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, pStr, nMergeAct, nMergeCnt ); // Some field types, can require a valid layout @@ -1523,7 +1507,7 @@ BOOL ViewShell::Prt( if (bSelection ) { // damit das Dokument nicht den Drucker mit ins Grab nimmt - pOutDevDoc->setPrinter( 0, false, false ); +// pOutDevDoc->setPrinter( 0, false, false ); /*TLPDF should not be needed anymore*/ if ( !pOutDevDoc->release() ) delete pOutDevDoc; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index ba7f79d681a8..bf45078b6550 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2614,7 +2614,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), false ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2655,6 +2656,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } const sal_Int32 nPageCount = pDoc->GetPageCount(); + + // get PageRange option OUString aPageRange; if (bIsPDFExport) { @@ -2671,7 +2674,6 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( { aPageRange = m_pPrintUIOptions->getStringValue( C2U( "PageRange" ), OUString() ); } - if (aPageRange.getLength() == 0) { // set page range to print to 'all pages' @@ -2680,18 +2682,27 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( aPageRange += OUString::valueOf( nPageCount ); } - // get set of valid pages (according to the current settings) - // and their start frames - pDoc->GetValidPagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); - DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); + // get number of pages to be rendered + if(bPrintProspect) + { + pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); + nRet = m_pPrintUIOptions->GetPagePairsForProspectPrinting().size(); + } + else + { + // get set of valid pages (according to the current settings) + // and their start frames + pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); + DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); - // get vector of pages to print according to PageRange and valid pages from above - // (result may be an empty vector, for example if the range string is not correct) - StringRangeEnumerator::getRangesFromString( - aPageRange, m_pPrintUIOptions->GetPagesToPrint(), - 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + // get vector of pages to print according to PageRange and valid pages from above + // (result may be an empty vector, for example if the range string is not correct) + StringRangeEnumerator::getRangesFromString( + aPageRange, m_pPrintUIOptions->GetPagesToPrint(), + 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); - nRet = m_pPrintUIOptions->GetPagesToPrint().size(); + nRet = m_pPrintUIOptions->GetPagesToPrint().size(); + } DBG_ASSERT( nRet >= 0, "negative number of pages???" ); return nRet; @@ -2803,7 +2814,8 @@ void SAL_CALL SwXTextDocument::render( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), false ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); // get view shell to use SfxViewShell *pView = 0; @@ -2830,7 +2842,8 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if (nRenderer >= sal_Int32(m_pPrintUIOptions->GetPagesToPrint().size())) + if ( (bPrintProspect && nRenderer >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) + || (!bPrintProspect && nRenderer >= m_pPrintUIOptions->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export @@ -2943,7 +2956,10 @@ void SAL_CALL SwXTextDocument::render( // <-- // TLPDF OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF - pVwSh->Prt( pOut, aOptions, *m_pPrintUIOptions, nRenderer, 0, bIsPDFExport ); + if (bPrintProspect) + pVwSh->PrintProspect( pOut, aOptions, *m_pPrintUIOptions, nRenderer ); + else // normal printing and PDF export + pVwSh->PrintOrPDFExport( pOut, aOptions, *m_pPrintUIOptions, nRenderer, bIsPDFExport ); // --> FME 2004-10-08 #i35176# // -- cgit v1.2.3 From 241b10510b86266f8bc169bdad3588e488647127 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 7 Aug 2009 15:49:37 +0000 Subject: #i92516# fix warning and brochure page size --- sw/source/core/doc/doc.cxx | 6 +++--- sw/source/ui/uno/unotxdoc.cxx | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 681af392f2dd..5f8e2a3c5265 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1184,7 +1184,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // now fill the vector for calculating the page pairs with the start frames // from the above obtained vector std::vector< const SwPageFrm * > aVec; - for (sal_Int32 i = 0; i < aPagesToPrint.size(); ++i) + for (size_t i = 0; i < aPagesToPrint.size(); ++i) { const sal_Int32 nPage = aPagesToPrint[i]; const SwPageFrm *pFrm = rValidStartFrms[ nPage ]; @@ -1247,7 +1247,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( } sal_Int32 nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1; - DBG_ASSERT( nCntPage * 2 == aVec.size(), "vector size vs. page count mismatch" ); + DBG_ASSERT( size_t(nCntPage * 2) == aVec.size(), "vector size vs. page count mismatch" ); for ( USHORT nPrintCount = 0; nSPg < nEPg && nPrintCount < nCntPage; ++nPrintCount ) @@ -1281,7 +1281,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( nSPg = nSPg + nStep; nEPg = nEPg - nStep; } - DBG_ASSERT( nCntPage == rPagePairs.size(), "size mismatch for number of page pairs" ); + DBG_ASSERT( size_t(nCntPage) == rPagePairs.size(), "size mismatch for number of page pairs" ); } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index bf45078b6550..2686026ef24f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2744,6 +2744,11 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( bool bSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bSkipEmptyPages ) ); + if( m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), sal_False ) ) + { + aPgSize = Size( aPgSize.Height(), aPgSize.Width() ); + } + awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); uno::Sequence< beans::PropertyValue > aRenderer(1); @@ -2842,8 +2847,8 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if ( (bPrintProspect && nRenderer >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) - || (!bPrintProspect && nRenderer >= m_pPrintUIOptions->GetPagesToPrint().size())) + if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) + || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export -- cgit v1.2.3 From 25550e914d7c353e5472ffb2db23efe95b76b2d3 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 10 Aug 2009 09:55:47 +0000 Subject: #i103991# prospect printing --- sw/source/core/view/viewpg.cxx | 8 +++++--- sw/source/ui/uno/unotxdoc.cxx | 9 +++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 49ec9bb483b3..283e6b6a79f2 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -782,7 +782,7 @@ void ViewShell::PrintProspect( // TLPDF Point aPrtOff( pPrt->PixelToLogic( pPrt->GetPageOffsetPixel(), aMapMode ) ); // TLPDF Size aTmpPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode ) ); - Point aPrtOff( pPrinter->PixelToLogic( pPrinter->GetPageOffsetPixel(), aMapMode ) ); /* TLPDF */ +// TLPDF Point aPrtOff( pPrinter->PixelToLogic( pPrinter->GetPageOffsetPixel(), aMapMode ) ); /* TLPDF */ Size aTmpPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ // dann kann das drucken losgehen @@ -793,7 +793,9 @@ void ViewShell::PrintProspect( pPrt->StartPage(); #endif - Point aSttPt; + // calculate start point for equal border on all sides + Point aSttPt( (aTmpPrtSize.Width() - nMaxColSz) / 2, + (aTmpPrtSize.Height() - nMaxRowSz) / 2 ); for( int nC = 0; nC < 2; ++nC ) { if( pStPage ) @@ -803,7 +805,7 @@ void ViewShell::PrintProspect( Point aPos( aSttPt ); aPos -= aShell.aVisArea.Pos(); - aPos -= aPrtOff; +// TLPDF aPos -= aPrtOff; aMapMode.SetOrigin( aPos ); pPrinter->SetMapMode( aMapMode ); pStPage->GetUpper()->Paint( pStPage->Frm() ); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 2686026ef24f..64971f8f49f8 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2743,14 +2743,11 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( bool bSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bSkipEmptyPages ) ); - - if( m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), sal_False ) ) - { - aPgSize = Size( aPgSize.Height(), aPgSize.Width() ); - } - awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); + // prospect printing should be landscape, thus switching width and height + if (m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), sal_False )) + aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); uno::Sequence< beans::PropertyValue > aRenderer(1); PropertyValue &rValue = aRenderer.getArray()[0]; rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); -- cgit v1.2.3 From 3afe7e6f516a073c319d413344761373dd6c55db Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 10 Aug 2009 12:19:26 +0000 Subject: #i103991# page range evaluation fixed --- sw/source/core/doc/doc.cxx | 29 ++++++++++++++++--------- sw/source/ui/uno/unotxdoc.cxx | 49 ++++++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 5f8e2a3c5265..8f8ccdbecdab 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1004,15 +1004,15 @@ void SwDoc::CalculatePagesForPrinting( bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now - bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); +//TLPDF bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( "PrintEmptyPages", false ); if (bIsPDFExport) { // PDF export UI does not allow for selecting left or right pages only or reverse print bPrintLeftPage = true; bPrintRightPage = true; - bPrintReverse = false; +// bPrintReverse = false; // TLPDF, TODO; take care of the option 'Export automatically inserted blank pages' // from the 'Export as PDF' (aka PDF Options) dialog. bPrintEmptyPages = false; @@ -1076,6 +1076,7 @@ void SwDoc::CalculatePagesForPrinting( aMulti = aTmpMulti; // Ende des HACKs +#ifdef TL_NOT_NOW /*TLPDF*/ if (bPrintReverse) { const SwFrm *pTmp = pStPage; @@ -1084,6 +1085,7 @@ void SwDoc::CalculatePagesForPrinting( nPageNo = nLastPageNo; } else +#endif // TL_NOT_NOW /*TLPDF*/ nPageNo = nFirstPageNo; std::set< sal_Int32 > &rValidPages = rPrintUIOptions.GetValidPagesSet(); @@ -1111,11 +1113,13 @@ void SwDoc::CalculatePagesForPrinting( { pStPage = 0; } +#ifdef TL_NOT_NOW /*TLPDF*/ else if ( bPrintReverse ) { --nPageNo; pStPage = (SwPageFrm*)pStPage->GetPrev(); } +#endif // TL_NOT_NOW /*TLPDF*/ else { ++nPageNo; pStPage = (SwPageFrm*)pStPage->GetNext(); @@ -1137,7 +1141,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( rValidPagesSet.clear(); rValidStartFrms.clear(); - rtl::OUString aPageRange = rPrintUIOptions.getStringValue( C2U( "PageRange" ), rtl::OUString() ); + rtl::OUString aPageRange = rPrintUIOptions.getStringValue( "PageRange", rtl::OUString() ); StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 ); DBG_ASSERT( pLayout, "no layout present" ); @@ -1171,9 +1175,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now - bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); +//TLPDF bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); - bool bPrintProspect_RTL = rPrintUIOptions.getIntValue( C2U( "PrintBrochureRTL" ), 0 ) ? true : false; + bool bPrintProspect_RTL = rPrintUIOptions.getIntValue( "PrintBrochureRTL", 0 ) ? true : false; // get pages for prospect printing according to the 'PageRange' // (duplicates and any order allowed!) @@ -1191,14 +1195,18 @@ void SwDoc::CalculatePagePairsForProspectPrinting( aVec.push_back( pFrm ); } - // auf Doppelseiten auffuellen - if ( 1 == aVec.size() ) // eine Seite ist ein Sonderfall - aVec.insert( aVec.begin() + 1, 0 ); + // just one page is special ... + if ( 1 == aVec.size() ) + aVec.insert( aVec.begin() + 1, 0 ); // insert a second empty page else { + // now extend the number of pages to fit a multiple of 4 + // (4 'normal' pages are needed for a single prospect paper + // with back and front) while( aVec.size() & 3 ) aVec.push_back( 0 ); +#ifdef TL_NOT_NOW /*TLPDF*/ if ( bPrintReverse && 4 < aVec.size() ) { // das Array umsortieren @@ -1230,6 +1238,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( ppArrHalf = &aVec[ 0 ] + aVec.size(); } } +#endif // TL_NOT_NOW /*TLPDF*/ } // dann sorge mal dafuer, das alle Seiten in der richtigen @@ -1246,8 +1255,8 @@ void SwDoc::CalculatePagePairsForProspectPrinting( ++nSPg, --nEPg; } + // the number of 'virtual' pages to be printed sal_Int32 nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1; - DBG_ASSERT( size_t(nCntPage * 2) == aVec.size(), "vector size vs. page count mismatch" ); for ( USHORT nPrintCount = 0; nSPg < nEPg && nPrintCount < nCntPage; ++nPrintCount ) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 64971f8f49f8..0121d2de348f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2614,7 +2614,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), false ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; @@ -2657,7 +2657,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const sal_Int32 nPageCount = pDoc->GetPageCount(); - // get PageRange option + // get PageRange value to use OUString aPageRange; if (bIsPDFExport) { @@ -2672,9 +2672,14 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } else { - aPageRange = m_pPrintUIOptions->getStringValue( C2U( "PageRange" ), OUString() ); + // PageContent : + // 0 -> print all pages + // 1 -> print range according to PageRange + // 2 -> print selection + if (1 == m_pPrintUIOptions->getIntValue( "PrintContent", 0 )) + aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); } - if (aPageRange.getLength() == 0) + if (aPageRange.getLength() == 0) // empty string -> print all { // set page range to print to 'all pages' aPageRange = OUString::valueOf( (sal_Int32)1 ); @@ -2683,7 +2688,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } // get number of pages to be rendered - if(bPrintProspect) + if (bPrintProspect) { pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); nRet = m_pPrintUIOptions->GetPagePairsForProspectPrinting().size(); @@ -2746,7 +2751,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); // prospect printing should be landscape, thus switching width and height - if (m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), sal_False )) + if (m_pPrintUIOptions->getBoolValue( "PrintBrochure", sal_False )) aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); uno::Sequence< beans::PropertyValue > aRenderer(1); PropertyValue &rValue = aRenderer.getArray()[0]; @@ -2816,7 +2821,7 @@ void SAL_CALL SwXTextDocument::render( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), false ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); // get view shell to use @@ -2825,7 +2830,7 @@ void SAL_CALL SwXTextDocument::render( pView = GuessViewShell(); else { - uno::Any aTmp( m_pPrintUIOptions->getValue( C2U("View") ) ); + uno::Any aTmp( m_pPrintUIOptions->getValue( C2U( "View" ) )); uno::Reference< frame::XController > xController; if (aTmp >>= xController) { @@ -2901,25 +2906,25 @@ void SAL_CALL SwXTextDocument::render( if( ! aOptions.bPrintRightPage ) nLeftRightPages = 1; nLeftRightPages = m_pPrintUIOptions->getIntValue( "PrintLeftRightPages", nLeftRightPages ); - aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintGraphic ); - aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintTable ); - aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( C2U( "PrintGraphicsAndDiagrams" ), aOptions.bPrintDraw ); - aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( C2U( "PrintControls" ), aOptions.bPrintControl ); + aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintGraphic ); + aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintTable ); + aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintDraw ); + aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( "PrintControls", aOptions.bPrintControl ); aOptions.bPrintLeftPage = nLeftRightPages == 0 || nLeftRightPages == 1; aOptions.bPrintRightPage = nLeftRightPages == 0 || nLeftRightPages == 2; - aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( C2U( "PrintBackground" ), aOptions.bPrintPageBackground ); - aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( C2U( "PrintEmptyPages" ), aOptions.bPrintEmptyPages ); + aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( "PrintBackground", aOptions.bPrintPageBackground ); + aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( "PrintEmptyPages", aOptions.bPrintEmptyPages ); // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( C2U( "PaperTray" ), aOptions.bPaperFromSetup ); - aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( C2U( "PrintReverseOrder" ), aOptions.bPrintReverse ); - aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( C2U( "PrintBrochure" ), aOptions.bPrintProspect ); - aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( C2U( "PrintBrochureRTL" ), aOptions.bPrintProspect_RTL ) ? true : false; + aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PaperTray", aOptions.bPaperFromSetup ); + aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( "PrintReverseOrder", aOptions.bPrintReverse ); + aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", aOptions.bPrintProspect ); + aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( "PrintBrochureRTL", aOptions.bPrintProspect_RTL ) ? true : false; // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( C2U( "PrintBlack" ), aOptions.bPrintBlackFont ); - aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( C2U( "PrintHiddenText" ), aOptions.bPrintHiddenText ); - aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( C2U( "PrintPlaceholder" ), aOptions.bPrintTextPlaceholder ); - aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( C2U( "PrintNotes" ), aOptions.nPrintPostIts )); + aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( "PrintBlack", aOptions.bPrintBlackFont ); + aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); + aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintPlaceholder", aOptions.bPrintTextPlaceholder ); + aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintNotes", aOptions.nPrintPostIts )); Range aPageRange( nRenderer+1, nRenderer+1 ); MultiSelection aPage( aPageRange ); -- cgit v1.2.3 From 8024a0f98383645946d25d83edd6d22ecd1f9702 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 10 Aug 2009 14:52:25 +0000 Subject: fix a warning --- sw/source/core/doc/doc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 8f8ccdbecdab..e17f01a88d2c 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1272,7 +1272,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( pNxtPage = pTmp; } - sal_Int32 nFirst, nSecond = -1; + sal_Int32 nFirst = -1, nSecond = -1; for ( int nC = 0; nC < 2; ++nC ) { sal_Int32 nPageNum = -1; -- cgit v1.2.3 From 3fbd3247c9d5d0ece2cda623250915bea14c066d Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 10 Aug 2009 17:36:31 +0000 Subject: #i92516# more changes for final UI spec --- sw/source/core/view/vprint.cxx | 101 +++++++++++++++++++++-------------------- sw/source/ui/config/optdlg.src | 69 ++++++++++++---------------- 2 files changed, 80 insertions(+), 90 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index e4083016131a..a1878283cf01 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -234,81 +234,81 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 46, "resource incomplete" ); - if( aLocalizedStrings.Count() < 46 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 44, "resource incomplete" ); + if( aLocalizedStrings.Count() < 44 ) // bad resource ? return; // create sequence of print UI options // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 17 : 20; + const int nNumProps = bWeb? 17 : 21; m_aUIProperties.realloc( nNumProps ); int nIdx = 0; // create "writer" section (new tab page in dialog) SvtModuleOptions aOpt; - String aAppGroupname( aLocalizedStrings.GetString( 54 ) ); + String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), aOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); // create sub section for Contents - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 0 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); // create a bool option for background - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 9 ), - aLocalizedStrings.GetString( 10 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), + aLocalizedStrings.GetString( 3 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), sal_True ); // create a bool option for graphics - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 1 ), - aLocalizedStrings.GetString( 2 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + aLocalizedStrings.GetString( 5 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphicsAndDiagrams" ) ), sal_True ); if (!bWeb) { // create a bool option for hidden text - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), - aLocalizedStrings.GetString( 14 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), + aLocalizedStrings.GetString( 7 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), sal_False ); // create a bool option for place holder - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 15 ), - aLocalizedStrings.GetString( 16 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), + aLocalizedStrings.GetString( 9 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), sal_False ); } // create a bool option for controls - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 7 ), - aLocalizedStrings.GetString( 8 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), + aLocalizedStrings.GetString( 11 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), sal_True ); // create sub section for Color - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 47 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() ); // create a bool option for black - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), - aLocalizedStrings.GetString( 12 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), + aLocalizedStrings.GetString( 14 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), sal_False ); // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 34 ) ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); // create a bool option for blank pages - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 35 ), - aLocalizedStrings.GetString( 36 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), + aLocalizedStrings.GetString( 17 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), sal_True ); // create a bool option for paper tray vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 37 ), - aLocalizedStrings.GetString( 38 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), + aLocalizedStrings.GetString( 19 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), sal_False, aPaperTrayOpt @@ -317,20 +317,20 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // print content selection vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 46 ) ), + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 20 ) ), rtl::OUString(), aContentsOpt ); // create a list box for notes content uno::Sequence< rtl::OUString > aChoices( 4 ); - aChoices[0] = aLocalizedStrings.GetString( 19 ); - aChoices[1] = aLocalizedStrings.GetString( 20 ); - aChoices[2] = aLocalizedStrings.GetString( 21 ); - aChoices[3] = aLocalizedStrings.GetString( 22 ); + aChoices[0] = aLocalizedStrings.GetString( 21 ); + aChoices[1] = aLocalizedStrings.GetString( 22 ); + aChoices[2] = aLocalizedStrings.GetString( 23 ); + aChoices[3] = aLocalizedStrings.GetString( 24 ); uno::Sequence< rtl::OUString > aHelpText( 2 ); - aHelpText[0] = aLocalizedStrings.GetString( 18 ); - aHelpText[1] = aLocalizedStrings.GetString( 18 ); - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), + aHelpText[0] = aLocalizedStrings.GetString( 25 ); + aHelpText[1] = aLocalizedStrings.GetString( 25 ); + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), aChoices, @@ -344,25 +344,28 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : if (!bWeb) { + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 27 ) ), + rtl::OUString(), + aPageSetOpt + ); uno::Sequence< rtl::OUString > aRLChoices( 3 ); - aRLChoices[0] = aLocalizedStrings.GetString( 51 ); - aRLChoices[1] = aLocalizedStrings.GetString( 52 ); - aRLChoices[2] = aLocalizedStrings.GetString( 53 ); + aRLChoices[0] = aLocalizedStrings.GetString( 28 ); + aRLChoices[1] = aLocalizedStrings.GetString( 29 ); + aRLChoices[2] = aLocalizedStrings.GetString( 30 ); uno::Sequence< rtl::OUString > aRLHelp( 1 ); - aRLHelp[0] = aLocalizedStrings.GetString( 50 ); + aRLHelp[0] = aLocalizedStrings.GetString( 31 ); // create a choice option for all/left/right pages - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 49 ), + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ), aRLHelp, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), - aRLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), - aPageSetOpt + aRLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) ); } // create a bool option for brochure rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 30 ), - aLocalizedStrings.GetString( 31 ), + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), + aLocalizedStrings.GetString( 34 ), aBrochurePropertyName, sal_False, aPageSetOpt @@ -370,8 +373,8 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for brochure RTL dependent on brochure uno::Sequence< rtl::OUString > aBRTLChoices( 3 ); - aBRTLChoices[0] = aLocalizedStrings.GetString( 55 ); - aBRTLChoices[1] = aLocalizedStrings.GetString( 56 ); + aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); + aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), @@ -385,7 +388,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); aPrintRangeOpt.mbInternalOnly = sal_True; - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 39 ) ), + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ), rtl::OUString(), aPrintRangeOpt ); @@ -394,12 +397,12 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); aChoices.realloc( 3 ); aHelpText.realloc( 3 ); - aChoices[0] = aLocalizedStrings.GetString( 40 ); - aHelpText[0] = aLocalizedStrings.GetString( 41 ); - aChoices[1] = aLocalizedStrings.GetString( 42 ); - aHelpText[1] = aLocalizedStrings.GetString( 43 ); - aChoices[2] = aLocalizedStrings.GetString( 44 ); - aHelpText[2] = aLocalizedStrings.GetString( 45 ); + aChoices[0] = aLocalizedStrings.GetString( 38 ); + aHelpText[0] = aLocalizedStrings.GetString( 39 ); + aChoices[1] = aLocalizedStrings.GetString( 40 ); + aHelpText[1] = aLocalizedStrings.GetString( 41 ); + aChoices[2] = aLocalizedStrings.GetString( 42 ); + aHelpText[2] = aLocalizedStrings.GetString( 43 ); m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), aHelpText, aPrintRangeName, diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index d6456f69d2a6..87bfc608ae41 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -940,63 +940,50 @@ StringArray STR_PRINTOPTUI { ItemList [en-US] = { + < "%PRODUCTNAME %s"; >; < "Contents"; >; - < "~Graphics and diagrams"; >; - < "Specifies whether the graphics of your text document are printed"; >; - < "~Tables"; >; - < "Specifies whether the tables of the text document are printed"; >; - < "Dra~wings"; >; - < "Specifies whether graphics created with %PRODUCTNAME drawing functions are printed."; >; - < "Form control~s"; >; - < "Specifies whether the form control fields of the text document are printed"; >; < "Page ba~ckground"; >; < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; - < "Print text in blac~k"; >; - < "Specifies whether to always print text in black."; >; + < "~Graphics and diagrams"; >; + < "Specifies whether the graphics of your text document are printed"; >; < "Hidden te~xt"; >; < "Enable this option to print text that is marked as hidden."; >; < "Text ~placeholder"; >; < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; - < "~Notes"; >; - < "Specify where to print notes (if any)."; >; + < "Form control~s"; >; + < "Specifies whether the form control fields of the text document are printed"; >; + < "Color"; >; + < "Print text in blac~k"; >; + < "Specifies whether to always print text in black."; >; + < "Pages"; >; + < "~Add blank pages for page breaks"; >; + < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; + < "~Use only paper tray from printer preferences"; >; + < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; + < "Print"; >; < "Document only"; >; < "Notes only"; >; < " at end of document"; >; < " at end of page"; >; - < "Page settings"; >; - < "~Left pages"; >; - < "Specifies whether to print all left pages of the document."; >; - < "~Right pages"; >; - < "Specifies whether to print all right pages of the document."; >; - < "Re~versed"; >; - < "Specifies whether to reverse the printing order."; >; + < "Specify where to print notes (if any)."; >; + < "~Notes"; >; + < "Page sides";>; + < "All pages"; >; + < "Back sides / left pages"; >; + < "Front sides / right pages"; >; + < "Specify which pages to include in the output"; >; + < "Include"; >; < "Broch~ure"; >; < "Select the Brochure option to print the document in brochure format."; >; - < "Right to Left"; >; - < "Check to print the pages of the brochure in the correct order for a right-to-left script."; >; - < "Pages"; >; - < "Print ~automatically inserted blank pages"; >; - < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; - < "~Paper tray from printer settings"; >; - < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; - < "Print Range"; >; + < "Left-to-right script"; >; + < "Right-to-left script"; >; + < "Ranges and copies"; >; < "~All pages"; >; - < "Print all pages of the document."; >; - < "~Pages"; >; + < "Print the whole document."; >; + < "Pa~ges"; >; < "Print a range of pages of the document."; >; < "~Selection"; >; - < "Print only the currently selected content."; >; - < "Print"; >; - < "Color"; >; - < "Paper tray"; >; - < "Include"; >; - < "Specify which pages to include in the output"; >; - < "left and right pages"; >; - < "left pages"; >; - < "right pages"; >; - < "%PRODUCTNAME %s"; >; - < "Left-to-right script"; >; - < "Right-to-left script"; >; + < "Print only the selected parts of the document"; >; }; }; -- cgit v1.2.3 From 8e2578389b45dca694fac1254813716bce9bdbac Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 10 Aug 2009 18:28:22 +0000 Subject: #i92516# more changes for final UI spec --- starmath/source/smres.src | 9 ++++----- starmath/source/unomodel.cxx | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/starmath/source/smres.src b/starmath/source/smres.src index fdf6ce2a7462..47f51fe18c04 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -3584,15 +3584,15 @@ StringArray RID_PRINTUIOPTIONS { ItemList [en-US] = { - <"Formula"; >; - < "Print options"; >; + < "%PRODUCTNAME %s"; >; + < "Contents"; >; < "~Title row"; >; < "Specifies whether you want the name of the document to be included in the printout"; >; < "~Formula text"; >; < "Specifies whether to include the contents of the \"Commands\" window at the bottom of the printout."; >; - < "B~order"; >; + < "B~orders"; >; < "Applies a thin border to the formula area in the printout."; >; - < "Print format"; >; + < "Size"; >; < "O~riginal size"; >; < "Prints the formula without adjusting the current font size."; >; < "Fit to ~page"; >; @@ -3602,7 +3602,6 @@ StringArray RID_PRINTUIOPTIONS < "Miscellaneous options"; >; < "Ig~nore ~~ and ` at the end of the line"; >; < "Specfies that these space wildcards will be removed if they are at the end of a line."; >; - < "%PRODUCTNAME %s"; >; }; }; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 54a4ae78207b..828dec857c9c 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -85,8 +85,8 @@ using namespace ::com::sun::star::script; SmPrintUIOptions::SmPrintUIOptions() { ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 19, "resource incomplete" ); - if( aLocalizedStrings.Count() < 19 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 18, "resource incomplete" ); + if( aLocalizedStrings.Count() < 18 ) // bad resource ? return; SmModule *pp = SM_MOD1(); @@ -101,7 +101,7 @@ SmPrintUIOptions::SmPrintUIOptions() // create Section for formula (results in an extra tab page in dialog) SvtModuleOptions aOpt; - String aAppGroupname( aLocalizedStrings.GetString( 18 ) ); + String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) ); m_aUIProperties[0].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); -- cgit v1.2.3 From 5efcf0dbf3ee0c6136f4a261b1b8f0ed1f013bbf Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 11 Aug 2009 08:25:58 +0000 Subject: fix warnings --- sw/source/core/doc/doc.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index e17f01a88d2c..e480138a8ca6 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1188,7 +1188,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // now fill the vector for calculating the page pairs with the start frames // from the above obtained vector std::vector< const SwPageFrm * > aVec; - for (size_t i = 0; i < aPagesToPrint.size(); ++i) + for ( i = 0; i < sal_Int32(aPagesToPrint.size()); ++i) { const sal_Int32 nPage = aPagesToPrint[i]; const SwPageFrm *pFrm = rValidStartFrms[ nPage ]; @@ -1275,13 +1275,13 @@ void SwDoc::CalculatePagePairsForProspectPrinting( sal_Int32 nFirst = -1, nSecond = -1; for ( int nC = 0; nC < 2; ++nC ) { - sal_Int32 nPageNum = -1; + sal_Int32 nPage = -1; if ( pStPage ) - nPageNum = pStPage->GetPhyPageNum(); + nPage = pStPage->GetPhyPageNum(); if (nC == 0) - nFirst = nPageNum; + nFirst = nPage; else - nSecond = nPageNum; + nSecond = nPage; pStPage = pNxtPage; } -- cgit v1.2.3 From 6f114639ebbd358fbe45f389e838595fea1cf88b Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 11 Aug 2009 12:37:03 +0000 Subject: #i103991# small clean-up --- sw/source/ui/uno/unotxdoc.cxx | 54 +++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 0121d2de348f..104e3257ccfb 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2614,7 +2614,6 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; @@ -2661,14 +2660,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( OUString aPageRange; if (bIsPDFExport) { -// uno::Any aSelection; - for( sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i ) - { - if( rxOptions[ i ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) - rxOptions[ i ].Value >>= aPageRange; -// else if( rxOptions[ i ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) ) ) -// rxOptions[ i ].Value >>= aSelection; - } +// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); + aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); } else { @@ -2688,6 +2681,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } // get number of pages to be rendered + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); if (bPrintProspect) { pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); @@ -2746,8 +2740,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (nRenderer >= pDoc->GetPageCount()) return uno::Sequence< beans::PropertyValue >(); - bool bSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); - Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bSkipEmptyPages ) ); + const bool bIsSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); + Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ) ); awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); // prospect printing should be landscape, thus switching width and height @@ -2866,24 +2860,9 @@ void SAL_CALL SwXTextDocument::render( ((SwPagePreView*)pView)->GetViewShell(); } + uno::Any aAny( m_pPrintUIOptions->getValue( C2U( "RenderDevice" ) )); uno::Reference< awt::XDevice > xRenderDevice; - bool bFirstPage = false; - bool bLastPage = false; - rtl::OUString aPages; - bool bSkipEmptyPages = false; - for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) - { - if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) - rxOptions[ nProperty].Value >>= xRenderDevice; - else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) ) ) - rxOptions[ nProperty].Value >>= bFirstPage; - else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ) ) - rxOptions[ nProperty].Value >>= bLastPage; - else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) - rxOptions[ nProperty].Value >>= aPages; - else if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ) ) - rxOptions[ nProperty].Value >>= bSkipEmptyPages; - } + aAny >>= xRenderDevice; OutputDevice* pOut = 0; if (xRenderDevice.is()) @@ -2894,6 +2873,11 @@ void SAL_CALL SwXTextDocument::render( if(pVwSh && pOut) { + const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); + const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); + const bool bIsSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); + const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); + SwPrtOptions aOptions( C2U("PDF export") ); // get print options to use from provided properties @@ -2926,11 +2910,11 @@ void SAL_CALL SwXTextDocument::render( aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintPlaceholder", aOptions.bPrintTextPlaceholder ); aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintNotes", aOptions.nPrintPostIts )); - Range aPageRange( nRenderer+1, nRenderer+1 ); - MultiSelection aPage( aPageRange ); - aPage.SetTotalRange( Range( 0, RANGE_MAX ) ); - aPage.Select( aPageRange ); - aOptions.aMulti = aPage; + Range aRange( nRenderer+1, nRenderer+1 ); + MultiSelection aPages( aRange ); + aPages.SetTotalRange( Range( 0, RANGE_MAX ) ); + aPages.Select( aRange ); + aOptions.aMulti = aPages; //! Note: Since for PDF export of (multi-)selection a temporary //! document is created that contains only the selects parts, @@ -2958,7 +2942,7 @@ void SAL_CALL SwXTextDocument::render( if (bIsPDFExport && bFirstPage && pWrtShell) /*TLPDF*/ { - SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPages, bSkipEmptyPages, sal_False ); + SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); } // <-- @@ -2976,7 +2960,7 @@ void SAL_CALL SwXTextDocument::render( // if (bIsPDFExport && bLastPage && pWrtShell) /*TLPDF*/ { - SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPages, bSkipEmptyPages, sal_True ); + SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); } // <-- -- cgit v1.2.3 From a6e4f39c82a75fb2684d3563b9c2a7af3518d2bc Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 14 Aug 2009 13:56:56 +0000 Subject: #i101242# new print UI --- sw/inc/IDocumentDeviceAccess.hxx | 2 +- sw/inc/doc.hxx | 9 +- sw/inc/printdata.hxx | 79 +++++++++++++++- sw/inc/swprtopt.hxx | 48 +--------- sw/inc/unomod.hxx | 2 +- sw/inc/unotxdoc.hxx | 9 +- sw/inc/viewsh.hxx | 36 +++++--- sw/source/core/doc/doc.cxx | 56 +++++------- sw/source/core/view/viewpg.cxx | 34 ++++--- sw/source/core/view/vprint.cxx | 189 +++++++++++++++++++++++++++------------ sw/source/ui/dbui/dbmgr.cxx | 90 +++++++++---------- sw/source/ui/inc/view.hxx | 2 +- sw/source/ui/uiview/viewprt.cxx | 44 ++++----- sw/source/ui/uno/unotxdoc.cxx | 131 ++++++++++++++------------- 14 files changed, 430 insertions(+), 301 deletions(-) diff --git a/sw/inc/IDocumentDeviceAccess.hxx b/sw/inc/IDocumentDeviceAccess.hxx index 30e698e74d70..fbfdd82d001b 100755 --- a/sw/inc/IDocumentDeviceAccess.hxx +++ b/sw/inc/IDocumentDeviceAccess.hxx @@ -33,7 +33,7 @@ class SfxPrinter; class JobSetup; - struct SwPrintData; + class SwPrintData; class VirtualDevice; class OutputDevice; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 2b1937f2912e..d2ec00c8ad0c 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -208,7 +208,8 @@ struct SwDocStat; struct SwHash; struct SwSortOptions; struct SwDefTOXBase_Impl; -struct SwPrintData; +class SwPrintData; +class SwPrintUIOptions; class SdrPageView; struct SwConversionArgs; class SwRewriter; @@ -216,7 +217,7 @@ class SwMsgPoolItem; class SwChartDataProvider; class SwChartLockController_Helper; class IGrammarContact; -class SwPrintUIOptions; +class SwPrintData; class SwPageFrm; namespace sw { namespace mark { @@ -1335,9 +1336,9 @@ public: // get the set of printable pages for the XRenderable API by // evaluating the respective settings (see implementation) - void CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, + void CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ); - void CalculatePagePairsForProspectPrinting( SwPrintUIOptions &rPrintUIOptions, + void CalculatePagePairsForProspectPrinting( SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ); sal_uInt16 GetPageCount() const; diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 1a6547ab540e..3ff07102733a 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -33,9 +33,75 @@ #include #include +#include -struct SwPrintData +#include +#include +#include +#include + +class SwPageFrm; + +//////////////////////////////////////////////////////////// + +class SwPrintUIOptions : public vcl::PrinterOptionsHelper +{ + OutputDevice* m_pLast; + + // pages valid for printing (according to the current settings) + // and their respective start frames (see getRendererCount in unotxdoc.cxx) + // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! + std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) + std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages + + // vector of pages and their order to be printed (duplicates and any order allowed!) + // (see 'render' in unotxdoc.cxx) + std::vector< sal_Int32 > aPagesToPrint; + + // for prospect printing: the pairs of pages to be printed together on a single prospect page. + // -1 indicates a half page to be left empty. + std::vector< std::pair< sal_Int32, sal_Int32 > > aPagePairs; + +public: + SwPrintUIOptions( BOOL bWeb = FALSE ); + ~SwPrintUIOptions(); + + bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + + typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; + typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; + + std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } + const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } + ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } + const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } + + // used for 'normal' printing + std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } + const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } + + // used for prospect printing only + PagePairsVec_t & GetPagePairsForProspectPrinting() { return aPagePairs; } + const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return aPagePairs; } + + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; + bool IsPrintEmptyPages( bool bIsPDFExport ) const; + bool IsPrintTables() const; + bool IsPrintGraphics() const; + bool IsPrintDrawings() const; +}; + + +//////////////////////////////////////////////////////////// + + +class SwPrintData { + const SwPrintUIOptions * m_pPrintUIOptions; + +public: + sal_Bool bPrintGraphic, bPrintTable, bPrintDraw, bPrintControl, bPrintPageBackground, bPrintBlackFont, //#i81434# - printing of hidden text @@ -55,6 +121,8 @@ struct SwPrintData SwPrintData() { + m_pPrintUIOptions = NULL; + bPrintGraphic = bPrintTable = bPrintDraw = @@ -103,6 +171,12 @@ struct SwPrintData bPrintHiddenText == rData.bPrintHiddenText && bPrintTextPlaceholder == rData.bPrintTextPlaceholder; } + + // Note: int the conntext where this class ist used the pointer should always be valid + // during the lifetime of this object + const SwPrintUIOptions & GetPrintUIOptions() const { return *m_pPrintUIOptions; } + void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; } + sal_Bool IsPrintGraphic() const { return bPrintGraphic; } sal_Bool IsPrintTable() const { return bPrintTable; } sal_Bool IsPrintDraw() const { return bPrintDraw; } @@ -139,8 +213,11 @@ struct SwPrintData void SetFaxName(const rtl::OUString& rSet){sFaxName = rSet;} void SetPrintHiddenText(sal_Bool b){ doSetModified(); bPrintHiddenText = b;} void SetPrintTextPlaceholder(sal_Bool b){ doSetModified(); bPrintTextPlaceholder = b;} + virtual void doSetModified () { bModified = sal_True;} }; +//////////////////////////////////////////////////////////// + #endif //_SW_PRINTDATA_HXX diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index 53b00bff4f07..86bcefa5d455 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -31,7 +31,6 @@ #ifndef _SWPRTOPT_HXX #define _SWPRTOPT_HXX -#include #include #include @@ -46,10 +45,9 @@ #define POSTITS_ENDPAGE 3 -class SwPageFrm; - //////////////////////////////////////////////////////////// + class SwPrtOptions : public SwPrintData { USHORT nJobNo; @@ -96,49 +94,5 @@ public: //////////////////////////////////////////////////////////// -class SwPrintUIOptions : public vcl::PrinterOptionsHelper -{ - OutputDevice* mpLast; - - // pages valid for printing (according to the current settings) - // and their respective start frames (see getRendererCount in unotxdoc.cxx) - // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! - std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) - std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages - - // vector of pages and their order to be printed (duplicates and any order allowed!) - // (see 'render' in unotxdoc.cxx) - std::vector< sal_Int32 > aPagesToPrint; - - // for prospect printing: the pairs of pages to be printed together on a single prospect page. - // -1 indicates a half page to be left empty. - std::vector< std::pair< sal_Int32, sal_Int32 > > aPagePairs; - -public: - SwPrintUIOptions( BOOL bWeb ); - - bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); - - typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; - typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; - - std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } - const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } - ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } - const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } - - // used for 'normal' printing - std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } - const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } - - // used for prospect printing only - PagePairsVec_t & GetPagePairsForProspectPrinting() { return aPagePairs; } - const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return aPagePairs; } - - bool IsPrintLeftPages() const; - bool IsPrintRightPages() const; -}; - - #endif //_SWPRTOPT_HXX diff --git a/sw/inc/unomod.hxx b/sw/inc/unomod.hxx index dcb2f9cfcbda..0f46a92f323e 100644 --- a/sw/inc/unomod.hxx +++ b/sw/inc/unomod.hxx @@ -45,7 +45,7 @@ class SwView; class SwViewOption; -struct SwPrintData; +class SwPrintData; class SwDoc; /****************************************************************************** diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 7b81a0ce191b..7292ce74fcff 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -127,6 +127,7 @@ class SwUnoCrsr; class SwXDocumentPropertyHelper; class SfxViewFrame; class SwPrintUIOptions; +class SwPrintData; typedef UnoActionContext* UnoActionContextPtr; SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) @@ -216,11 +217,11 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, css::uno::Reference< css::container::XNameContainer> xXFormsContainer; //temporary frame to enable PDF export if no valid view is available - SfxViewFrame* m_pHiddenViewFrame; - css::uno::Reference< css::uno::XInterface> xPropertyHelper; - SwXDocumentPropertyHelper* pPropertyHelper; + SfxViewFrame* m_pHiddenViewFrame; + css::uno::Reference< css::uno::XInterface> xPropertyHelper; + SwXDocumentPropertyHelper* pPropertyHelper; - SwPrintUIOptions* m_pPrintUIOptions; + SwPrintUIOptions* m_pPrintUIOprions; void GetBodyText(); void GetNumberFormatter(); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 007fc7c05ed3..9e4f89fb1134 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -71,7 +71,7 @@ class SfxViewShell; class SwViewOption; class SwViewImp; class SwPrtOptions; -class SwPrintUIOptions; +class SwPrintData; class SwPagePreViewPrtData; class Window; class OutputDevice; @@ -94,12 +94,19 @@ class SwPostItMgr; // #i74769# class SdrPaintWindow; +namespace vcl +{ + class PrinterController; +}; + + //JP 19.07.98: - Bug 52312 // define fuer Flags, die im CTOR oder den darunter liegenden Schichten // benoetigt werden. // Zur Zeit wird fuer die DrawPage das PreView Flag benoetigt #define VSHELLFLAG_ISPREVIEW ((long)0x1) + class SW_DLLPUBLIC ViewShell : public Ring { friend void SetOutDev( ViewShell *pSh, OutputDevice *pOut ); @@ -188,7 +195,7 @@ class SW_DLLPUBLIC ViewShell : public Ring SW_DLLPRIVATE void Scroll(); //Scrollen wenn sich aus der LayAction Scrollmoeglichkeiten //ergaben. - SW_DLLPRIVATE void PrepareForPrint( const SwPrtOptions &rOptions ); + SW_DLLPRIVATE void PrepareForPrint( const SwPrintData &rOptions ); SW_DLLPRIVATE void ImplApplyViewOptions( const SwViewOption &rOpt ); @@ -363,20 +370,27 @@ public: void ChgAllPageOrientation( sal_uInt16 eOri ); void ChgAllPageSize( Size &rSz ); - //Druckauftrag abwickeln. + // printing of one page. // bIsPDFExport == true is: do PDF Export (no printing!) - sal_Bool PrintOrPDFExport( OutputDevice* pOutDev, SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, + sal_Bool PrintOrPDFExport( OutputDevice *pOutDev, const SwPrtOptions &rPrintData, sal_Int32 nRenderer, /* offset in vector of pages to print */ bool bIsPDFExport = sal_False ); - // Prospekt-Format drucken - void PrintProspect( OutputDevice* pOutDev, SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, - sal_Int32 nRenderer /* offset in vector of page pairs for prospect */ ); + // printing of one brochure page + void PrintProspect( OutputDevice *pOutDev, const SwPrintData &rPrintData, + sal_Int32 nRenderer /* offset in vector of page pairs for prospect printing */ ); + + // printing of a complete document for mail merge + // bIsPDFExport == true is: do PDF Export (no printing!) + sal_Bool PrintOrPDFExportMM( const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrtOptions &rPrintData, bool bIsPDFExport = sal_False ); + + // printing of a complete brochure for mail merge + void PrintProspectMM( const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrintData &rPrintData, bool bProspectRTL ); - //"Drucken" fuer OLE 2.0 - static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, + // printing for OLE 2.0 + static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions, OutputDevice* pOleOut, const Rectangle& rRect ); // creates temporary doc with selected text for PDF export diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index e480138a8ca6..ca02f3e2eb30 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -993,7 +993,7 @@ const SwDocStat& SwDoc::GetDocStat() const void SwDoc::CalculatePagesForPrinting( bool bIsPDFExport, - SwPrintUIOptions &rPrintUIOptions, + SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { DBG_ASSERT( pLayout, "no layout present" ); @@ -1001,22 +1001,12 @@ void SwDoc::CalculatePagesForPrinting( return; // properties to take into account when calcualting the set of pages - bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); - bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); + // (PDF export UI does not allow for selecting left or right pages only) + bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages(); + bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages(); // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now -//TLPDF bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( "PrintEmptyPages", false ); - - if (bIsPDFExport) - { - // PDF export UI does not allow for selecting left or right pages only or reverse print - bPrintLeftPage = true; - bPrintRightPage = true; -// bPrintReverse = false; - // TLPDF, TODO; take care of the option 'Export automatically inserted blank pages' - // from the 'Export as PDF' (aka PDF Options) dialog. - bPrintEmptyPages = false; - } +//TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + bool bPrintEmptyPages = rOptions.IsPrintEmptyPages( bIsPDFExport ); Range aPages( 1, nDocPageCount ); @@ -1088,16 +1078,16 @@ void SwDoc::CalculatePagesForPrinting( #endif // TL_NOT_NOW /*TLPDF*/ nPageNo = nFirstPageNo; - std::set< sal_Int32 > &rValidPages = rPrintUIOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rPrintUIOptions.GetValidStartFrms(); + std::set< sal_Int32 > &rValidPages = rOptions.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrms(); rValidPages.clear(); rValidStartFrms.clear(); while ( pStPage ) { const BOOL bRightPg = pStPage->OnRightPage(); if ( aMulti.IsSelected( nPageNo ) && - ( (bRightPg && bPrintRightPage) || - (!bRightPg && bPrintLeftPage) ) ) + ( (bRightPg && bPrintRightPages) || + (!bRightPg && bPrintLeftPages) ) ) { // --> FME 2005-12-12 #b6354161# Feature - Print empty pages if ( bPrintEmptyPages || pStPage->Frm().Height() ) @@ -1130,18 +1120,18 @@ void SwDoc::CalculatePagesForPrinting( void SwDoc::CalculatePagePairsForProspectPrinting( - SwPrintUIOptions &rPrintUIOptions, + SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { - std::set< sal_Int32 > &rValidPagesSet = rPrintUIOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rPrintUIOptions.GetValidStartFrms(); - std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rPrintUIOptions.GetPagePairsForProspectPrinting(); + std::set< sal_Int32 > &rValidPagesSet = rOptions.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrms(); + std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rOptions.GetPagePairsForProspectPrinting(); rPagePairs.clear(); rValidPagesSet.clear(); rValidStartFrms.clear(); - rtl::OUString aPageRange = rPrintUIOptions.getStringValue( "PageRange", rtl::OUString() ); + rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() ); StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 ); DBG_ASSERT( pLayout, "no layout present" ); @@ -1170,14 +1160,14 @@ void SwDoc::CalculatePagePairsForProspectPrinting( DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" ); // properties to take into account when calcualting the set of pages - // Note: here bPrintLeftPage and bPrintRightPage refer to the (virtual) resulting pages + // Note: here bPrintLeftPages and bPrintRightPages refer to the (virtual) resulting pages // of the prospect! - bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); - bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); + bool bPrintLeftPages = rOptions.IsPrintLeftPages(); + bool bPrintRightPages = rOptions.IsPrintRightPages(); // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now -//TLPDF bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); - bool bPrintProspect_RTL = rPrintUIOptions.getIntValue( "PrintBrochureRTL", 0 ) ? true : false; +//TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); + bool bPrintProspect_RTL = rOptions.getIntValue( "PrintBrochureRTL", 0 ) ? true : false; // get pages for prospect printing according to the 'PageRange' // (duplicates and any order allowed!) @@ -1247,9 +1237,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( if ( 0 == (nEPg & 1 )) // ungerade gibt es nicht! --nEPg; - if ( !bPrintLeftPage ) + if ( !bPrintLeftPages ) ++nStep; - else if ( !bPrintRightPage ) + else if ( !bPrintRightPages ) { ++nStep; ++nSPg, --nEPg; diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 283e6b6a79f2..fbcae6776d82 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -447,18 +447,30 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, pFntCache->Flush(); } + +void ViewShell::PrintProspectMM( + const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrintData & rPrintData, + bool bProspectRTL ) +{ + (void) rpPrinterController; (void) rPrintData; (void) bProspectRTL; + + Printer::PrintJob( rpPrinterController, JobSetup() ); +} + + // print brochure // OD 05.05.2003 #i14016# - consider empty pages on calculation of the scaling // for a page to be printed. void ViewShell::PrintProspect( OutputDevice* pOutDev, - SwPrtOptions& rOptions, - const SwPrintUIOptions & rPrintUIOptions, /* TLPDF keep this or the above? */ - sal_Int32 nRenderer ) + const SwPrintData & rPrintData, + sal_Int32 nRenderer // the index in the vector of prospect pages to be printed + ) { // TLPDF if( !rOptions.aMulti.GetSelectCount() ) Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); - if (!pPrinter || rPrintUIOptions.GetPagePairsForProspectPrinting().size() <= 0) + if (!pPrinter || rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting().size() <= 0) return; #ifdef TL_NOT_NOW /*TLPDF*/ @@ -475,15 +487,15 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintUIOptions.GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); #endif std::pair< sal_Int32, sal_Int32 > rPagesToPrint = - rPrintUIOptions.GetPagePairsForProspectPrinting()[ nRenderer ]; + rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting()[ nRenderer ]; const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? rPagesToPrint.first : rPagesToPrint.second); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( rPagesToPrint.first == -1 || rPrintUIOptions.GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); - DBG_ASSERT( rPagesToPrint.second == -1 || rPrintUIOptions.GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); + DBG_ASSERT( rPagesToPrint.first == -1 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); + DBG_ASSERT( rPagesToPrint.second == -1 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); #endif /* TLPDF neu: end */ @@ -509,7 +521,7 @@ void ViewShell::PrintProspect( SET_CURR_SHELL( &aShell ); - aShell.PrepareForPrint( rOptions ); + aShell.PrepareForPrint( rPrintData ); // gibt es versteckte Absatzfelder, unnoetig wenn die Absaetze bereits // ausgeblendet sind. @@ -541,7 +553,7 @@ void ViewShell::PrintProspect( #ifdef TL_NOT_NOW /*TLPDF*/ should not happen any more since the test - rPrintUIOptions.GetPagePairsForProspectPrinting().size() <= 0 + rPrintData.GetPagePairsForProspectPrinting().size() <= 0 above should have taken care that there is at least one page to print if( !pStPage ) // dann wars das { @@ -680,7 +692,7 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ const SwPageFrm *pStPage = 0; const SwPageFrm *pNxtPage = 0; - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); if (rPagesToPrint.first > 0) { SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index a1878283cf01..23cf28e938ea 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -230,7 +230,7 @@ const XubString& SwPrtOptions::MakeNextJobName() /*****************************************************************************/ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : - mpLast( NULL ) + m_pLast( NULL ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -257,13 +257,13 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for background m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), sal_True ); // create a bool option for graphics m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphicsAndDiagrams" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTablesGraphicsAndDiagrams" ) ), sal_True ); if (!bWeb) { @@ -276,7 +276,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for place holder m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), aLocalizedStrings.GetString( 9 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), sal_False ); } @@ -292,7 +292,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for black m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), sal_False ); // create subgroup for misc options @@ -309,7 +309,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), aLocalizedStrings.GetString( 19 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), sal_False, aPaperTrayOpt ); @@ -332,7 +332,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aHelpText[1] = aLocalizedStrings.GetString( 25 ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), aHelpText, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), aChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) @@ -363,7 +363,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : } // create a bool option for brochure - rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); + rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), aLocalizedStrings.GetString( 34 ), aBrochurePropertyName, @@ -379,7 +379,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), uno::Sequence< rtl::OUString >(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), aBRTLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), aBrochureRTLOpt ); @@ -417,22 +417,79 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aPageRangeOpt ); - DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } + +SwPrintUIOptions::~SwPrintUIOptions() +{ +} + bool SwPrintUIOptions::IsPrintLeftPages() const { - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); - return nLRPages == 0 || nLRPages == 1; + // take care of different property names for the option. + // for compatibility the old name should win + + // 0: left and right pages + // 1: left pages only + // 2: right pages only + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); + bool bRes = nLRPages == 0 || nLRPages == 1; + bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ ); + return bRes; } bool SwPrintUIOptions::IsPrintRightPages() const { - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); - return nLRPages == 0 || nLRPages == 2; + // take care of different property names for the option. + // for compatibility the old name should win + + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); + bool bRes = nLRPages == 0 || nLRPages == 2; + bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ ); + return bRes; } +bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const +{ + // take care of different property names for the option. + + bool bRes = bIsPDFExport ? + !getBoolValue( "IsSkipEmptyPages", sal_True ) : + getBoolValue( "PrintEmptyPages", sal_True ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintTables() const +{ + // take care of different property names for the option. + // for compatibility the old name should win + + bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bRes = getBoolValue( "PrintTables", bRes ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintGraphics() const +{ + // take care of different property names for the option. + // for compatibility the old name should win + + bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bRes = getBoolValue( "PrintGraphics", bRes ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintDrawings() const +{ + // take care of different property names for the option. + // for compatibility the old name should win + + bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bRes = getBoolValue( "PrintDDrawings", bRes ); + return bRes; +} + bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) { bool bChanged = processProperties( i_rNewProp ); @@ -447,9 +504,9 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); pOut = pDevice ? pDevice->GetOutputDevice() : 0; } - bChanged = bChanged || (pOut != mpLast); + bChanged = bChanged || (pOut != m_pLast); if( pOut ) - mpLast = pOut; + m_pLast = pOut; return bChanged; } @@ -938,6 +995,9 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, const SwFrm *pPage = pLayout->Lower(); SwLayAction aAction( pLayout, Imp() ); +#ifdef TL_NOT_NOW /*TLPDF*/ +//Currently we have no progress bar here. It is handled in the new Print UI now. +//Not year clear: what about Progressbar in MailMerge if( pProgress ) { // HACK, damit die Anzeige sich nicht verschluckt. @@ -947,6 +1007,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? aAction.SetProgress(pProgress); } +#endif // TL_NOT_NOW /*TLPDF*/ pLayout->StartAllAction(); for ( USHORT i = 1; pPage && i <= nMax; pPage = pPage->GetNext(), ++i ) @@ -954,6 +1015,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) break; +#ifdef TL_NOT_NOW /*TLPDF*/ if( pProgress ) { //HACK, damit die Anzeige sich nicht verschluckt. @@ -961,6 +1023,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, lcl_SetState( *pProgress, i, nStatMax, pStr, nMergeAct, nMergeCnt, 0, i ); pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? } +#endif // TL_NOT_NOW /*TLPDF*/ if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) break; @@ -980,8 +1043,10 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, Imp()->SetFirstVisPageInvalid(); SwPaintQueue::Repaint(); +#ifdef TL_NOT_NOW /*TLPDF*/ if ( pProgress ) pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? +#endif // TL_NOT_NOW /*TLPDF*/ } if (pProgress) @@ -1175,11 +1240,23 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) } +sal_Bool ViewShell::PrintOrPDFExportMM( + const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrtOptions &rPrintData, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ + bool bIsPDFExport ) +{ + (void) rpPrinterController; (void) rPrintData; (void) bIsPDFExport; + + + Printer::PrintJob( rpPrinterController, JobSetup() ); + return sal_True; +} + + sal_Bool ViewShell::PrintOrPDFExport( OutputDevice* pOutDev, - SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, /* TLPDF keep this or the above? */ - sal_Int32 nRenderer, + const SwPrtOptions &rPrintData, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ + sal_Int32 nRenderer, // the index in the vector of pages to be printed bool bIsPDFExport ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -1190,11 +1267,11 @@ sal_Bool ViewShell::PrintOrPDFExport( //! Note: Since for PDF export of (multi-)selection a temporary //! document is created that contains only the selects parts, //! and thus that document is to printed in whole the, - //! rOptions.bPrintSelection parameter will be false. - BOOL bSelection = rOptions.bPrintSelection; + //! rPrintData.bPrintSelection parameter will be false. + BOOL bSelection = rPrintData.bPrintSelection; // TLPDF: this one should hold just one page now. Thus clean-up should be possible - MultiSelection aMulti( rOptions.aMulti ); + MultiSelection aMulti( rPrintData.aMulti ); if ( !pOutDev || !aMulti.GetSelectCount() ) return bStartJob; @@ -1270,21 +1347,21 @@ sal_Bool ViewShell::PrintOrPDFExport( // save options at draw view: SwDrawViewSave aDrawViewSave( pShell->GetDrawView() ); - pShell->PrepareForPrint( rOptions ); + pShell->PrepareForPrint( rPrintData ); XubString* pStr = 0; - ULONG nMergeAct = rOptions.nMergeAct, nMergeCnt = rOptions.nMergeCnt; +//TLPDF ULONG nMergeAct = rPrintData.nMergeAct, nMergeCnt = rPrintData.nMergeCnt; /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintUIOptions.GetPagesToPrint().size(), "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetPrintUIOptions().GetPagesToPrint().size(), "nRenderer out of bounds"); #endif - const sal_Int32 nPage = rPrintUIOptions.GetPagesToPrint()[ nRenderer ]; /* TLPDF */ + const sal_Int32 nPage = rPrintData.GetPrintUIOptions().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( rPrintUIOptions.GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); + DBG_ASSERT( rPrintData.GetPrintUIOptions().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); const SwPageFrm *pStPage = aIt->second; @@ -1293,7 +1370,7 @@ sal_Bool ViewShell::PrintOrPDFExport( // ben�tigte Seiten fuers Drucken formatieren pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, pStr, - nMergeAct, nMergeCnt ); + 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); // Some field types, can require a valid layout // (expression fields in tables). For these we do an UpdateFlds @@ -1301,19 +1378,19 @@ sal_Bool ViewShell::PrintOrPDFExport( // --> FME 2004-06-21 #i9684# For performance reasons, we do not update // the fields during pdf export. // #i56195# prevent update of fields (for mail merge) - if ( !bIsPDFExport && rOptions.bUpdateFieldsInPrinting ) + if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) // <-- pShell->UpdateFlds(TRUE); // TLPDF if( !pShell->Imp()->IsStopOutDev() && -// TLPDF ( bIsPDFExport || rOptions.GetJobName().Len() || pOutDev->IsJobActive()) ) +// TLPDF ( bIsPDFExport || rPrintData.GetJobName().Len() || pOutDev->IsJobActive()) ) if( /*!pShell->Imp()->IsStopOutDev() && */ - ( bIsPDFExport || rOptions.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) + ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; - XubString sJobName( rOptions.GetJobName() ); + XubString sJobName( rPrintData.GetJobName() ); // HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit // geschaffen werden, alle Seiten von Seite x an zu deselektieren. @@ -1342,7 +1419,7 @@ sal_Bool ViewShell::PrintOrPDFExport( _SetGetExpFlds aPostItFields; SwDoc* pPostItDoc = 0; ViewShell* pPostItShell = 0; - if( rOptions.nPrintPostIts != POSTITS_NONE ) + if( rPrintData.nPrintPostIts != POSTITS_NONE ) { lcl_GetPostIts( pDoc, aPostItFields ); pPostItDoc = new SwDoc; @@ -1354,11 +1431,11 @@ sal_Bool ViewShell::PrintOrPDFExport( pShell->GetViewOptions() ); // Wenn PostIts am Dokumentenende gedruckt werden sollen, // die Druckreihenfolge allerdings umgekehrt ist, dann hier - if ( ( rOptions.nPrintPostIts == POSTITS_ENDDOC ) && - rOptions.bPrintReverse ) + if ( ( rPrintData.nPrintPostIts == POSTITS_ENDDOC ) && + rPrintData.bPrintReverse ) lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, TRUE ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, TRUE ); } @@ -1370,7 +1447,7 @@ sal_Bool ViewShell::PrintOrPDFExport( // BOOL bSetPaperSz = FALSE; BOOL bSetPrt = FALSE; - if ( rOptions.nPrintPostIts != POSTITS_ONLY ) + if ( rPrintData.nPrintPostIts != POSTITS_ONLY ) { //TLPDF while( pStPage && !bStop ) { @@ -1381,7 +1458,7 @@ sal_Bool ViewShell::PrintOrPDFExport( { aOldMapMode = pOutDev->GetMapMode(); Point aNewOrigin = pOutDev->GetMapMode().GetOrigin(); - aNewOrigin += rOptions.aOffset; + aNewOrigin += rPrintData.aOffset; MapMode aTmp( pOutDev->GetMapMode() ); aTmp.SetOrigin( aNewOrigin ); pOutDev->SetMapMode( aTmp ); @@ -1437,12 +1514,12 @@ sal_Bool ViewShell::PrintOrPDFExport( // Wenn PostIts nach Seite gedruckt werden sollen, // jedoch Reverse eingestellt ist ... - if( rOptions.bPrintReverse && - rOptions.nPrintPostIts == POSTITS_ENDPAGE ) + if( rPrintData.bPrintReverse && + rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, nPage /* TLPDF nPageNo*/, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, + rPrintData.bPrintReverse ); if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError @@ -1456,7 +1533,7 @@ sal_Bool ViewShell::PrintOrPDFExport( nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages -// TLPDF if ( rOptions.bPrintEmptyPages || pStPage->Frm().Height() ) +// TLPDF if ( rPrintData.bPrintEmptyPages || pStPage->Frm().Height() ) // <-- { pStPage->GetUpper()->Paint( pStPage->Frm() ); @@ -1464,12 +1541,12 @@ sal_Bool ViewShell::PrintOrPDFExport( SwPaintQueue::Repaint(); // Wenn PostIts nach Seite gedruckt werden sollen ... - if( (!rOptions.bPrintReverse) && - rOptions.nPrintPostIts == POSTITS_ENDPAGE ) + if( (!rPrintData.bPrintReverse) && + rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, nPage /* TLPDF nPageNo */, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, + rPrintData.bPrintReverse ); } // den eventl. fuer Umschlaege modifizierte OutDevOffset wieder @@ -1483,12 +1560,12 @@ sal_Bool ViewShell::PrintOrPDFExport( if (!bStop) // TLPDF: see break above { // Wenn PostIts am Dokumentenende gedruckt werden sollen, dann hier machen - if( ((rOptions.nPrintPostIts == POSTITS_ENDDOC) && !rOptions.bPrintReverse) - || (rOptions.nPrintPostIts == POSTITS_ONLY) ) + if( ((rPrintData.nPrintPostIts == POSTITS_ENDDOC) && !rPrintData.bPrintReverse) + || (rPrintData.nPrintPostIts == POSTITS_ONLY) ) lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, + rPrintData.bPrintReverse ); if( pPostItShell ) { @@ -1496,8 +1573,8 @@ sal_Bool ViewShell::PrintOrPDFExport( delete pPostItShell; //Nimmt das PostItDoc mit ins Grab. } - if( bStartJob ) - rOptions.bJobStartet = TRUE; +//TLPDF if( bStartJob ) +//TLPDF rPrintData.bJobStartet = TRUE; } // TLPDF: if (!bStop) see break above } @@ -1532,7 +1609,7 @@ sal_Bool ViewShell::PrintOrPDFExport( -void ViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, +void ViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions, OutputDevice* pOleOut, const Rectangle& rRect ) { //Wir brauchen eine Shell fuer das Drucken. Entweder hat das Doc schon @@ -1679,7 +1756,7 @@ SwDrawViewSave::~SwDrawViewSave() // OD 09.01.2003 #i6467# - method also called for page preview -void ViewShell::PrepareForPrint( const SwPrtOptions &rOptions ) +void ViewShell::PrepareForPrint( const SwPrintData &rOptions ) { // Viewoptions fuer den Drucker setzen pOpt->SetGraphic ( TRUE == rOptions.bPrintGraphic ); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 97d882c3a8e1..e53f5d766427 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -79,7 +79,8 @@ #include #include #include -#include +#include +//#include #include #include #include @@ -877,11 +878,11 @@ SwNewDBMgr::~SwNewDBMgr() --------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrint( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) +BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, + SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) { - (void) rView; (void) rOpt; (void) rProgress; (void) bIsAPI; /* TLPDF */ -#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + return TRUE; +#ifdef TL_NOT_NOW /*TLPDF*/ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section BOOL bSynchronizedDoc = pSh->IsLabelDoc() && pSh->GetSectionFmtCount() > 1; @@ -904,12 +905,12 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); pModOpt->SetSinglePrintJob(rOpt.IsPrintSingleJobs()); - SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); -#ifdef TL_NOT_NOW /*TLPDF*/ - Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); - if( rOpt.IsPrintSingleJobs() ) - pPrt->SetEndPrintHdl( Link() ); -#endif +//TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); + const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF + vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF +//TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); +//TLPDF if( rOpt.IsPrintSingleJobs() ) +//TLPDF pPrt->SetEndPrintHdl( Link() ); BOOL bUserBreak = FALSE, bRet = FALSE; @@ -986,23 +987,27 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); pPrt->StartJob( rOpt.GetJobName() ); } -#endif if( pPrt->IsJobActive() ) { - pSh->PrintProspect( rOpt, rProgress, rOpt.IsPrintProspect_RTL() ); + pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); /* TLPDF */ bRet = TRUE; } +#endif // TL_NOT_NOW /*TLPDF*/ + pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF + bRet = TRUE; // TLPDF } - else if( pSh->Prt( pPrt, rOpt, &rProgress ) ) /* TLPDF */ + else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; +#ifdef TL_NOT_NOW /*TLPDF*/ if( !pPrt->IsJobActive() ) { bUserBreak = TRUE; bRet = FALSE; break; } +#endif // TL_NOT_NOW /*TLPDF*/ if( !rOpt.IsPrintSingleJobs() ) { String& rJNm = (String&)rOpt.GetJobName(); @@ -1012,15 +1017,16 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; } while( bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()); -#ifdef TL_NOT_NOW /*TLPDF*/ if( rOpt.IsPrintSingleJobs() ) { - SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); - pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); - if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? - aSfxSaveLnk.Call( pTmpPrinter ); +//TLPDF SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); +//TLPDF const boost::shared_ptr< Printer > pTmpPrinter( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF +//TLPDF vcl::OldStylePrintAdaptor aPrtAdaptor( pTmpPrinter ); + // TLPDF +//TLPDF pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); +//TLPDF if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? +//TLPDF aSfxSaveLnk.Call( pTmpPrinter ); } -#endif rOpt.nMergeCnt = 0; rOpt.nMergeAct = 0; @@ -1039,29 +1045,28 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, } return bRet; -#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer - return TRUE; /* TLPDF */ +#endif // TL_NOT_NOW /*TLPDF*/ } /*-- 21.06.2004 09:08:16--------------------------------------------------- -----------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) +BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, + SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) { - (void) rView; (void) rOpt; (void) rProgress; (void) bIsAPI; /* TLPDF */ -#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + return TRUE; +#ifdef TL_NOT_NOW /*TLPDF*/ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section //merge source is already open rOpt.nMergeCnt = 0; rOpt.SetPrintSingleJobs( sal_True ); - SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); -#ifdef TL_NOT_NOW /*TLPDF*/ - Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); - if( rOpt.IsPrintSingleJobs() ) - pPrt->SetEndPrintHdl( Link() ); -#endif +//TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); + const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF + vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF +//TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); +//TLPDF if( rOpt.IsPrintSingleJobs() ) +//TLPDF pPrt->SetEndPrintHdl( Link() ); BOOL bUserBreak = FALSE, bRet = FALSE; @@ -1152,17 +1157,13 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, bMergeLock = TRUE; if(rOpt.IsPrintProspect()) { - if( pPrt->IsJobActive() -#ifdef TL_NOT_NOW /*TLPDF*/ - || pPrt->StartJob( rOpt.GetJobName() ) -#endif - ) - { - pSh->PrintProspect( rOpt, rProgress, rOpt.IsPrintProspect_RTL() ); +//TLPDF if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) +//TLPDF { + pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); bRet = TRUE; - } +//TLPDF } } - else if( pSh->Prt( pPrt, rOpt, &rProgress ) ) /* TLPDF */ + else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; @@ -1179,15 +1180,15 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, } } -#ifdef TL_NOT_NOW /*TLPDF*/ if( rOpt.IsPrintSingleJobs() ) { +#ifdef TL_NOT_NOW /*TLPDF*/ SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? aSfxSaveLnk.Call( pTmpPrinter ); +#endif // TL_NOT_NOW /*TLPDF*/ } -#endif rOpt.nMergeCnt = 0; rOpt.nMergeAct = 0; @@ -1206,8 +1207,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, } return bRet; -#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer - return TRUE; /* TLPDF */ +#endif // TL_NOT_NOW /*TLPDF*/ } diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 7ddfc2775299..0fb458573a61 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -88,7 +88,7 @@ class SwPrtOptions; class SwTransferable; class SwMailMergeConfigItem; class SwTxtNode; // #i23726# -struct SwPrintData; +class SwPrintData; class SwFormatClipboard; struct SwConversionArgs; class Graphic; diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index a6faae1894da..ab601c6926c3 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -47,6 +47,7 @@ #endif #include +#include #include #include #include @@ -174,9 +175,8 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) +ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, BOOL bIsAPI ) { - #if 0 // First test SwWrtShell* pSh = &GetWrtShell(); SwNewDBMgr* pMgr = pSh->GetNewDBMgr(); @@ -200,10 +200,10 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / } // Der PrintProgress stellt Handler am Printer der ViewShell ein. -// Das kann natuerlich erste nach dem evtl. Umschalten des Druckers korrekt +// Das kann natuerlich erst nach dem evtl. Umschalten des Druckers korrekt // funktionieren. #55210# // SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); - SfxPrintProgress *pProgress = 0; + /* TLPDF SfxPrintProgress */ SfxProgress *pProgress = 0; SfxPrinter *pDocPrinter = GetPrinter(TRUE); if ( !pPrinter ) pPrinter = pDocPrinter; @@ -211,13 +211,17 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / { //Da der Doc-Drucker beim SetPrinter geloescht wird, // muss man ihn vorher clonen - SfxPrinter* pClone = pDocPrinter->Clone(); - SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); - pProgress = new SfxPrintProgress( this, !bSilent ); - pProgress->RestoreOnEndPrint( pClone ); +//TLPDF SfxPrinter* pClone = pDocPrinter->Clone(); +//TLPDF SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); +//TLPDF pProgress = new SfxPrintProgress( this, !bSilent ); +//TLPDF pProgress->RestoreOnEndPrint( pClone ); } if(!pProgress) - pProgress = new SfxPrintProgress( this, !bSilent ); +//TLPDF pProgress = new SfxPrintProgress( this, !bSilent ); + { + SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell(); // TLPDF ?? + pProgress = new SfxProgress( pObjShell, String(), 1 ); // TLPDF ?? + } pProgress->SetWaitMode(FALSE); BOOL bStartJob = pPrinter->InitJob( &GetEditWin(), @@ -384,16 +388,16 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / SetAdditionalPrintOptions(aViewProperties); SfxViewShell::Print(*pProgress, bIsAPI ); - if ( !pProgress->IsAborted() ) +//TLPDF if ( !pProgress->IsAborted() ) { if( bPrtPros ) { - bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); - if( bStartJob ) - pSh->PrintProspect( aOpts, *pProgress, bPrtPros_RTL ); +//TLPDF bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); +//TLPDF if( bStartJob ) + pSh->PrintProspectMM( aPrtAdaptor, aOpts, bPrtPros_RTL ); /* TLPDF */ } else - bStartJob = pSh->Prt( pPrinter, aOpts, pProgress ); /*TLPDF*/ + bStartJob = pSh->PrintOrPDFExportMM( aPrtAdaptor, aOpts ); /*TLPDF*/ if ( bBrowse ) { @@ -404,8 +408,8 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / pSh->UnlockPaint(); } } - else - bStartJob = FALSE; +//TLPDF else +//TLPDF bStartJob = FALSE; pSh->LockView( bLockedView ); } @@ -432,13 +436,9 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / } pProgress->Stop(); - pProgress->DeleteOnEndPrint(); - pPrinter->EndJob(); +//TLPDF pProgress->DeleteOnEndPrint(); +//TLPDF pPrinter->EndJob(); return pPrinter->GetError(); - #else - DBG_ERROR( "dead code" ); - return ERRCODE_IO_NOTSUPPORTED; - #endif } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 104e3257ccfb..135e0c05bc10 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -360,7 +360,7 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : pxLinkTargetSupplier(0), pxXRedlines(0), m_pHiddenViewFrame(0), - m_pPrintUIOptions( NULL ) + m_pPrintUIOprions( NULL ) { } /*-- 18.12.98 11:53:00--------------------------------------------------- @@ -375,7 +375,7 @@ SwXTextDocument::~SwXTextDocument() xNumFmtAgg->setDelegator(x0); xNumFmtAgg = 0; } - delete m_pPrintUIOptions; + delete m_pPrintUIOprions; } @@ -2608,13 +2608,13 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOptions ) + if( ! m_pPrintUIOprions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + m_pPrintUIOprions = new SwPrintUIOptions( bWebDoc ); } - bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + bool bFormat = m_pPrintUIOprions->processPropertiesAndCheckFormat( rxOptions ); + const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2660,8 +2660,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( OUString aPageRange; if (bIsPDFExport) { -// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); - aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); +// TLPDF ?? m_pPrintUIOprions->getValue( C2U("Selection") ); + aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); } else { @@ -2669,8 +2669,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // 0 -> print all pages // 1 -> print range according to PageRange // 2 -> print selection - if (1 == m_pPrintUIOptions->getIntValue( "PrintContent", 0 )) - aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); + if (1 == m_pPrintUIOprions->getIntValue( "PrintContent", 0 )) + aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); } if (aPageRange.getLength() == 0) // empty string -> print all { @@ -2681,26 +2681,26 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } // get number of pages to be rendered - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); + const bool bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", false ); if (bPrintProspect) { - pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); - nRet = m_pPrintUIOptions->GetPagePairsForProspectPrinting().size(); + pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOprions, nPageCount ); + nRet = m_pPrintUIOprions->GetPagePairsForProspectPrinting().size(); } else { // get set of valid pages (according to the current settings) // and their start frames - pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); + pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOprions, nPageCount ); DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); // get vector of pages to print according to PageRange and valid pages from above // (result may be an empty vector, for example if the range string is not correct) StringRangeEnumerator::getRangesFromString( - aPageRange, m_pPrintUIOptions->GetPagesToPrint(), - 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + aPageRange, m_pPrintUIOprions->GetPagesToPrint(), + 1, nPageCount, 0, &m_pPrintUIOprions->GetValidPagesSet() ); - nRet = m_pPrintUIOptions->GetPagesToPrint().size(); + nRet = m_pPrintUIOprions->GetPagesToPrint().size(); } DBG_ASSERT( nRet >= 0, "negative number of pages???" ); @@ -2719,13 +2719,13 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOptions ) + if( ! m_pPrintUIOprions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2740,19 +2740,21 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (nRenderer >= pDoc->GetPageCount()) return uno::Sequence< beans::PropertyValue >(); - const bool bIsSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages(); Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ) ); awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); // prospect printing should be landscape, thus switching width and height - if (m_pPrintUIOptions->getBoolValue( "PrintBrochure", sal_False )) + if (m_pPrintUIOprions->getBoolValue( "PrintProspect", sal_False )) aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); - uno::Sequence< beans::PropertyValue > aRenderer(1); + uno::Sequence< beans::PropertyValue > aRenderer(2); PropertyValue &rValue = aRenderer.getArray()[0]; rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; + rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); + rValue.Value <<= sal_False; - m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); + m_pPrintUIOprions->appendPrintUIOptions( aRenderer ); return aRenderer; } @@ -2809,14 +2811,14 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); - if (!m_pPrintUIOptions) + if (!m_pPrintUIOprions) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + m_pPrintUIOprions = new SwPrintUIOptions( bWebDoc ); } - m_pPrintUIOptions->processProperties( rxOptions ); - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + m_pPrintUIOprions->processProperties( rxOptions ); + const bool bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", false ); + const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); // get view shell to use SfxViewShell *pView = 0; @@ -2824,7 +2826,7 @@ void SAL_CALL SwXTextDocument::render( pView = GuessViewShell(); else { - uno::Any aTmp( m_pPrintUIOptions->getValue( C2U( "View" ) )); + uno::Any aTmp( m_pPrintUIOprions->getValue( C2U( "View" ) )); uno::Reference< frame::XController > xController; if (aTmp >>= xController) { @@ -2843,8 +2845,8 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) - || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagesToPrint().size())) + if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOprions->GetPagePairsForProspectPrinting().size()) + || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOprions->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export @@ -2860,7 +2862,7 @@ void SAL_CALL SwXTextDocument::render( ((SwPagePreView*)pView)->GetViewShell(); } - uno::Any aAny( m_pPrintUIOptions->getValue( C2U( "RenderDevice" ) )); + uno::Any aAny( m_pPrintUIOprions->getValue( C2U( "RenderDevice" ) )); uno::Reference< awt::XDevice > xRenderDevice; aAny >>= xRenderDevice; @@ -2873,42 +2875,42 @@ void SAL_CALL SwXTextDocument::render( if(pVwSh && pOut) { - const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); - const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); - const bool bIsSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); - const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); - - SwPrtOptions aOptions( C2U("PDF export") ); + // TLPDF2DO: clean-up, need to check if only one of aOptions and m_pPrintUIOprions should be used + SwPrtOptions aOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ); - // get print options to use from provided properties + // get default print options const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); - sal_Int64 nLeftRightPages = 0; - if( ! aOptions.bPrintLeftPage ) - nLeftRightPages = 2; - if( ! aOptions.bPrintRightPage ) - nLeftRightPages = 1; - nLeftRightPages = m_pPrintUIOptions->getIntValue( "PrintLeftRightPages", nLeftRightPages ); - aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintGraphic ); - aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintTable ); - aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintDraw ); - aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( "PrintControls", aOptions.bPrintControl ); - aOptions.bPrintLeftPage = nLeftRightPages == 0 || nLeftRightPages == 1; - aOptions.bPrintRightPage = nLeftRightPages == 0 || nLeftRightPages == 2; - aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( "PrintBackground", aOptions.bPrintPageBackground ); - aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( "PrintEmptyPages", aOptions.bPrintEmptyPages ); + + // get print options to use from provided properties + const rtl::OUString aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); + const bool bFirstPage = m_pPrintUIOprions->getBoolValue( "IsFirstPage", sal_False ); + const bool bLastPage = m_pPrintUIOprions->getBoolValue( "IsLastPage", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOprions->IsPrintEmptyPages( bIsPDFExport ); + aOptions.bPrintGraphic = m_pPrintUIOprions->IsPrintGraphics(); + aOptions.bPrintTable = m_pPrintUIOprions->IsPrintTables(); + aOptions.bPrintDraw = m_pPrintUIOprions->IsPrintDrawings(); + aOptions.bPrintControl = m_pPrintUIOprions->getBoolValue( "PrintControls", aOptions.bPrintControl ); + aOptions.bPrintLeftPage = m_pPrintUIOprions->IsPrintLeftPages(); + aOptions.bPrintRightPage = m_pPrintUIOprions->IsPrintRigthPages(); + aOptions.bPrintPageBackground = m_pPrintUIOprions->getBoolValue( "PrintPageBackground", aOptions.bPrintPageBackground ); + aOptions.bPrintEmptyPages = !bIsSkipEmptyPages; // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PaperTray", aOptions.bPaperFromSetup ); - aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( "PrintReverseOrder", aOptions.bPrintReverse ); - aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", aOptions.bPrintProspect ); - aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( "PrintBrochureRTL", aOptions.bPrintProspect_RTL ) ? true : false; + aOptions.bPaperFromSetup = m_pPrintUIOprions->getBoolValue( "PrintPaperFromSetup", aOptions.bPaperFromSetup ); + aOptions.bPrintReverse = m_pPrintUIOprions->getBoolValue( "PrintReversed", aOptions.bPrintReverse ); + aOptions.bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", aOptions.bPrintProspect ); + aOptions.bPrintProspect_RTL = m_pPrintUIOprions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspect_RTL ) ? true : false; // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( "PrintBlack", aOptions.bPrintBlackFont ); - aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); - aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintPlaceholder", aOptions.bPrintTextPlaceholder ); - aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintNotes", aOptions.nPrintPostIts )); + aOptions.bPrintBlackFont = m_pPrintUIOprions->getBoolValue( "PrintBlackFonts", aOptions.bPrintBlackFont ); + aOptions.bPrintHiddenText = m_pPrintUIOprions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); + aOptions.bPrintTextPlaceholder = m_pPrintUIOprions->getBoolValue( "PrintTextPlaceholder", aOptions.bPrintTextPlaceholder ); + aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOprions->getIntValue( "PrintAnnotationMode", aOptions.nPrintPostIts )); + + //! needs to be set after MakeOptions since the assingment operation in that + //! function will destroy this pointer + aOptions.SetPrintUIOptions( m_pPrintUIOprions ); Range aRange( nRenderer+1, nRenderer+1 ); MultiSelection aPages( aRange ); @@ -2948,9 +2950,9 @@ void SAL_CALL SwXTextDocument::render( // TLPDF OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF if (bPrintProspect) - pVwSh->PrintProspect( pOut, aOptions, *m_pPrintUIOptions, nRenderer ); + pVwSh->PrintProspect( pOut, aOptions, nRenderer ); else // normal printing and PDF export - pVwSh->PrintOrPDFExport( pOut, aOptions, *m_pPrintUIOptions, nRenderer, bIsPDFExport ); + pVwSh->PrintOrPDFExport( pOut, aOptions, nRenderer, bIsPDFExport ); // --> FME 2004-10-08 #i35176# // @@ -2977,7 +2979,8 @@ void SAL_CALL SwXTextDocument::render( lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); m_pHiddenViewFrame = 0; } - delete m_pPrintUIOptions, m_pPrintUIOptions = NULL; + aOptions.SetPrintUIOptions( NULL ); + delete m_pPrintUIOprions, m_pPrintUIOprions = NULL; } } } -- cgit v1.2.3 From 31c68b3b56ce4ffc1649fe83dd3f1dca97eb7551 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 14 Aug 2009 14:00:36 +0000 Subject: #i101242# new print UI --- sw/inc/viewsh.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 9e4f89fb1134..350a095b6a69 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -97,7 +97,7 @@ class SdrPaintWindow; namespace vcl { class PrinterController; -}; +} //JP 19.07.98: - Bug 52312 -- cgit v1.2.3 From dc48e555979cd69935d36231c75311933b5bbb1f Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 14 Aug 2009 14:39:33 +0000 Subject: #i101242# new print UI --- sw/source/core/view/vprint.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 23cf28e938ea..e30f8702e8b4 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -979,7 +979,7 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, - const XubString* pStr, ULONG nMergeAct, ULONG nMergeCnt ) + const XubString* /*pStr*/, ULONG nMergeAct, ULONG nMergeCnt ) { SET_CURR_SHELL( this ); -- cgit v1.2.3 -- cgit v1.2.3 From 58ed8009f73a0424b6eec189100380eafda39ea7 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 15 Aug 2009 16:53:19 +0000 Subject: #i92516# move solar.hrc to vcl --- starmath/inc/starmath.hrc | 2 +- starmath/source/math_pch.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index e957ee454bdf..ea9f2cd793f6 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -31,7 +31,7 @@ #define _STARMATH_HRC #ifndef _SVX_SVXIDS_HRC -#include +#include #endif #ifndef _SFXSIDS_HRC //autogen #include diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx index 5ea88307fb2d..308eed0858d2 100644 --- a/starmath/source/math_pch.cxx +++ b/starmath/source/math_pch.cxx @@ -131,7 +131,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3 From 41de88368a73475ba75c0fd47974f5fefdff2aaf Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 15 Aug 2009 16:55:10 +0000 Subject: #i92516# move solar.hrc to vcl --- sw/inc/helpid.h | 2 +- sw/inc/pch/precompiled_sw.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index f709c95038f0..dca700fbb8b6 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -28,7 +28,7 @@ * ************************************************************************/ #ifndef _SOLAR_HRC -#include +#include #endif #define HID_BASE HID_APP_START diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index fc62291e85c7..a95604e32b0f 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -679,7 +679,7 @@ #include "svtools/slstitm.hxx" #include "svtools/smplhint.hxx" #include "svtools/soerr.hxx" -#include "svtools/solar.hrc" +#include "vcl/solar.hrc" #include "svtools/sourceviewconfig.hxx" #include "svtools/stdctrl.hxx" #include "svtools/stritem.hxx" -- cgit v1.2.3 From 0ea31f2a9b6657925852ac5f3128ff2937e2a18d Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sun, 16 Aug 2009 14:49:58 +0000 Subject: #i92516# fix warnings --- sw/source/core/view/vprint.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index e30f8702e8b4..46fd54f09ac4 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -979,7 +979,7 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, - const XubString* /*pStr*/, ULONG nMergeAct, ULONG nMergeCnt ) + const XubString* /*pStr*/, ULONG nMergeAct, ULONG /*nMergeCnt*/ ) { SET_CURR_SHELL( this ); @@ -990,7 +990,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, SfxPrinter* pPrt = getIDocumentDeviceAccess()->getPrinter( false ); BOOL bPrtJob = pPrt ? pPrt->IsJobActive() : FALSE; SwRootFrm* pLayout = GetLayout(); - ULONG nStatMax = pLayout->GetPageNum(); + // ULONG nStatMax = pLayout->GetPageNum(); const SwFrm *pPage = pLayout->Lower(); SwLayAction aAction( pLayout, Imp() ); -- cgit v1.2.3 From 0ccccd51bf9de6e53f32840754fce46307efbf57 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sun, 16 Aug 2009 15:10:35 +0000 Subject: fix warning --- sw/source/core/view/vprint.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 46fd54f09ac4..31074dc1ac2c 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -979,7 +979,7 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, - const XubString* /*pStr*/, ULONG nMergeAct, ULONG /*nMergeCnt*/ ) + const XubString* /*pStr*/, ULONG /*nMergeAct*/, ULONG /*nMergeCnt*/ ) { SET_CURR_SHELL( this ); -- cgit v1.2.3 From 84d95bba0af714d81a889c6eb194d3e4ed21fa21 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 17 Aug 2009 09:18:18 +0000 Subject: #i101242# new print UI --- sw/inc/unotxdoc.hxx | 2 +- sw/source/core/view/vprint.cxx | 4 ++ sw/source/ui/dbui/dbmgr.cxx | 10 ++-- sw/source/ui/uiview/viewprt.cxx | 11 +++-- sw/source/ui/uno/unotxdoc.cxx | 106 ++++++++++++++++++++-------------------- 5 files changed, 72 insertions(+), 61 deletions(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 7292ce74fcff..216516d0d879 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -221,7 +221,7 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, css::uno::Reference< css::uno::XInterface> xPropertyHelper; SwXDocumentPropertyHelper* pPropertyHelper; - SwPrintUIOptions* m_pPrintUIOprions; + SwPrintUIOptions* m_pPrintUIOptions; void GetBodyText(); void GetNumberFormatter(); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 31074dc1ac2c..351f1126103c 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -979,7 +979,11 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, +<<<<<<< .mine + const XubString* /*TLPDF pStr*/, ULONG /*TLPDF nMergeAct*/, ULONG /*TLPDF nMergeCnt*/ ) +======= const XubString* /*pStr*/, ULONG /*nMergeAct*/, ULONG /*nMergeCnt*/ ) +>>>>>>> .r275036 { SET_CURR_SHELL( this ); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index e53f5d766427..62fe78702d1f 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -908,6 +908,7 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, //TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF + const boost::shared_ptr< vcl::PrinterController > pPrtController( &aPrtAdaptor ); //TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); //TLPDF if( rOpt.IsPrintSingleJobs() ) //TLPDF pPrt->SetEndPrintHdl( Link() ); @@ -993,10 +994,10 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, bRet = TRUE; } #endif // TL_NOT_NOW /*TLPDF*/ - pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF + pSh->PrintProspectMM( pPrtController, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF bRet = TRUE; // TLPDF } - else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, rOpt ) /* TLPDF */ ) + else if( pSh->PrintOrPDFExportMM( pPrtController, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; @@ -1064,6 +1065,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, //TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF + const boost::shared_ptr< vcl::PrinterController > pPrtController( &aPrtAdaptor ); //TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); //TLPDF if( rOpt.IsPrintSingleJobs() ) //TLPDF pPrt->SetEndPrintHdl( Link() ); @@ -1159,11 +1161,11 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, { //TLPDF if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) //TLPDF { - pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); + pSh->PrintProspectMM( pPrtController, rOpt, rOpt.IsPrintProspect_RTL() ); bRet = TRUE; //TLPDF } } - else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, rOpt ) /* TLPDF */ ) + else if( pSh->PrintOrPDFExportMM( pPrtController, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index ab601c6926c3..9d51c50ae19e 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -371,7 +372,7 @@ ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, pViewProperties[10].Value <<= (text::NotePrintMode) aOpts.GetPrintPostIts(); pViewProperties[11].Name = C2U("PrintProspect"); pViewProperties[11].Value <<= (sal_Bool)aOpts.IsPrintProspect(); - pViewProperties[12].Name = C2U("PrintPageBackground"); + pViewProperties[12].Name = C2U("PrintPageBackground"); pViewProperties[12].Value <<= (sal_Bool)aOpts.IsPrintPageBackground(); pViewProperties[13].Name = C2U("PrintBlackFonts"); pViewProperties[13].Value <<= (sal_Bool)aOpts.IsPrintBlackFont(); @@ -390,14 +391,18 @@ ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, SfxViewShell::Print(*pProgress, bIsAPI ); //TLPDF if ( !pProgress->IsAborted() ) { + const boost::shared_ptr< Printer > pPrt( pPrinter ); // TLPDF + vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF + const boost::shared_ptr< vcl::PrinterController > pPrtController( &aPrtAdaptor ); + if( bPrtPros ) { //TLPDF bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); //TLPDF if( bStartJob ) - pSh->PrintProspectMM( aPrtAdaptor, aOpts, bPrtPros_RTL ); /* TLPDF */ + pSh->PrintProspectMM( pPrtController, aOpts, bPrtPros_RTL ); /* TLPDF */ } else - bStartJob = pSh->PrintOrPDFExportMM( aPrtAdaptor, aOpts ); /*TLPDF*/ + bStartJob = pSh->PrintOrPDFExportMM( pPrtController, aOpts ); /*TLPDF*/ if ( bBrowse ) { diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 135e0c05bc10..aa50d3f71372 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -360,7 +360,7 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : pxLinkTargetSupplier(0), pxXRedlines(0), m_pHiddenViewFrame(0), - m_pPrintUIOprions( NULL ) + m_pPrintUIOptions( NULL ) { } /*-- 18.12.98 11:53:00--------------------------------------------------- @@ -375,7 +375,7 @@ SwXTextDocument::~SwXTextDocument() xNumFmtAgg->setDelegator(x0); xNumFmtAgg = 0; } - delete m_pPrintUIOprions; + delete m_pPrintUIOptions; } @@ -2608,13 +2608,13 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOprions ) + if( ! m_pPrintUIOptions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOprions = new SwPrintUIOptions( bWebDoc ); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } - bool bFormat = m_pPrintUIOprions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); + bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2660,8 +2660,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( OUString aPageRange; if (bIsPDFExport) { -// TLPDF ?? m_pPrintUIOprions->getValue( C2U("Selection") ); - aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); +// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); + aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); } else { @@ -2669,8 +2669,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // 0 -> print all pages // 1 -> print range according to PageRange // 2 -> print selection - if (1 == m_pPrintUIOprions->getIntValue( "PrintContent", 0 )) - aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); + if (1 == m_pPrintUIOptions->getIntValue( "PrintContent", 0 )) + aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); } if (aPageRange.getLength() == 0) // empty string -> print all { @@ -2681,26 +2681,26 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } // get number of pages to be rendered - const bool bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", false ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); if (bPrintProspect) { - pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOprions, nPageCount ); - nRet = m_pPrintUIOprions->GetPagePairsForProspectPrinting().size(); + pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); + nRet = m_pPrintUIOptions->GetPagePairsForProspectPrinting().size(); } else { // get set of valid pages (according to the current settings) // and their start frames - pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOprions, nPageCount ); + pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); // get vector of pages to print according to PageRange and valid pages from above // (result may be an empty vector, for example if the range string is not correct) StringRangeEnumerator::getRangesFromString( - aPageRange, m_pPrintUIOprions->GetPagesToPrint(), - 1, nPageCount, 0, &m_pPrintUIOprions->GetValidPagesSet() ); + aPageRange, m_pPrintUIOptions->GetPagesToPrint(), + 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); - nRet = m_pPrintUIOprions->GetPagesToPrint().size(); + nRet = m_pPrintUIOptions->GetPagesToPrint().size(); } DBG_ASSERT( nRet >= 0, "negative number of pages???" ); @@ -2719,13 +2719,13 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOprions ) + if( ! m_pPrintUIOptions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2740,12 +2740,12 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (nRenderer >= pDoc->GetPageCount()) return uno::Sequence< beans::PropertyValue >(); - bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages(); + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ) ); awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); // prospect printing should be landscape, thus switching width and height - if (m_pPrintUIOprions->getBoolValue( "PrintProspect", sal_False )) + if (m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False )) aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); uno::Sequence< beans::PropertyValue > aRenderer(2); PropertyValue &rValue = aRenderer.getArray()[0]; @@ -2754,7 +2754,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); rValue.Value <<= sal_False; - m_pPrintUIOprions->appendPrintUIOptions( aRenderer ); + m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); return aRenderer; } @@ -2811,14 +2811,14 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); - if (!m_pPrintUIOprions) + if (!m_pPrintUIOptions) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOprions = new SwPrintUIOptions( bWebDoc ); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } - m_pPrintUIOprions->processProperties( rxOptions ); - const bool bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", false ); - const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); + m_pPrintUIOptions->processProperties( rxOptions ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); // get view shell to use SfxViewShell *pView = 0; @@ -2826,7 +2826,7 @@ void SAL_CALL SwXTextDocument::render( pView = GuessViewShell(); else { - uno::Any aTmp( m_pPrintUIOprions->getValue( C2U( "View" ) )); + uno::Any aTmp( m_pPrintUIOptions->getValue( C2U( "View" ) )); uno::Reference< frame::XController > xController; if (aTmp >>= xController) { @@ -2845,8 +2845,8 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOprions->GetPagePairsForProspectPrinting().size()) - || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOprions->GetPagesToPrint().size())) + if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) + || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export @@ -2862,7 +2862,7 @@ void SAL_CALL SwXTextDocument::render( ((SwPagePreView*)pView)->GetViewShell(); } - uno::Any aAny( m_pPrintUIOprions->getValue( C2U( "RenderDevice" ) )); + uno::Any aAny( m_pPrintUIOptions->getValue( C2U( "RenderDevice" ) )); uno::Reference< awt::XDevice > xRenderDevice; aAny >>= xRenderDevice; @@ -2875,7 +2875,7 @@ void SAL_CALL SwXTextDocument::render( if(pVwSh && pOut) { - // TLPDF2DO: clean-up, need to check if only one of aOptions and m_pPrintUIOprions should be used + // TLPDF2DO: clean-up, need to check if only one of aOptions and m_pPrintUIOptions should be used SwPrtOptions aOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ); // get default print options @@ -2884,33 +2884,33 @@ void SAL_CALL SwXTextDocument::render( SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); // get print options to use from provided properties - const rtl::OUString aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); - const bool bFirstPage = m_pPrintUIOprions->getBoolValue( "IsFirstPage", sal_False ); - const bool bLastPage = m_pPrintUIOprions->getBoolValue( "IsLastPage", sal_False ); - bool bIsSkipEmptyPages = !m_pPrintUIOprions->IsPrintEmptyPages( bIsPDFExport ); - aOptions.bPrintGraphic = m_pPrintUIOprions->IsPrintGraphics(); - aOptions.bPrintTable = m_pPrintUIOprions->IsPrintTables(); - aOptions.bPrintDraw = m_pPrintUIOprions->IsPrintDrawings(); - aOptions.bPrintControl = m_pPrintUIOprions->getBoolValue( "PrintControls", aOptions.bPrintControl ); - aOptions.bPrintLeftPage = m_pPrintUIOprions->IsPrintLeftPages(); - aOptions.bPrintRightPage = m_pPrintUIOprions->IsPrintRigthPages(); - aOptions.bPrintPageBackground = m_pPrintUIOprions->getBoolValue( "PrintPageBackground", aOptions.bPrintPageBackground ); + const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); + const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); + const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); + aOptions.bPrintGraphic = m_pPrintUIOptions->IsPrintGraphics(); + aOptions.bPrintTable = m_pPrintUIOptions->IsPrintTables(); + aOptions.bPrintDraw = m_pPrintUIOptions->IsPrintDrawings(); + aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( "PrintControls", aOptions.bPrintControl ); + aOptions.bPrintLeftPage = m_pPrintUIOptions->IsPrintLeftPages(); + aOptions.bPrintRightPage = m_pPrintUIOptions->IsPrintRightPages(); + aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( "PrintPageBackground", aOptions.bPrintPageBackground ); aOptions.bPrintEmptyPages = !bIsSkipEmptyPages; // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPaperFromSetup = m_pPrintUIOprions->getBoolValue( "PrintPaperFromSetup", aOptions.bPaperFromSetup ); - aOptions.bPrintReverse = m_pPrintUIOprions->getBoolValue( "PrintReversed", aOptions.bPrintReverse ); - aOptions.bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", aOptions.bPrintProspect ); - aOptions.bPrintProspect_RTL = m_pPrintUIOprions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspect_RTL ) ? true : false; + aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", aOptions.bPaperFromSetup ); + aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( "PrintReversed", aOptions.bPrintReverse ); + aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", aOptions.bPrintProspect ); + aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspect_RTL ) ? true : false; // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPrintBlackFont = m_pPrintUIOprions->getBoolValue( "PrintBlackFonts", aOptions.bPrintBlackFont ); - aOptions.bPrintHiddenText = m_pPrintUIOprions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); - aOptions.bPrintTextPlaceholder = m_pPrintUIOprions->getBoolValue( "PrintTextPlaceholder", aOptions.bPrintTextPlaceholder ); - aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOprions->getIntValue( "PrintAnnotationMode", aOptions.nPrintPostIts )); + aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( "PrintBlackFonts", aOptions.bPrintBlackFont ); + aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); + aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintTextPlaceholder", aOptions.bPrintTextPlaceholder ); + aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", aOptions.nPrintPostIts )); //! needs to be set after MakeOptions since the assingment operation in that //! function will destroy this pointer - aOptions.SetPrintUIOptions( m_pPrintUIOprions ); + aOptions.SetPrintUIOptions( m_pPrintUIOptions ); Range aRange( nRenderer+1, nRenderer+1 ); MultiSelection aPages( aRange ); @@ -2980,7 +2980,7 @@ void SAL_CALL SwXTextDocument::render( m_pHiddenViewFrame = 0; } aOptions.SetPrintUIOptions( NULL ); - delete m_pPrintUIOprions, m_pPrintUIOprions = NULL; + delete m_pPrintUIOptions, m_pPrintUIOptions = NULL; } } } -- cgit v1.2.3 From 2cca472c56275721e42111c72cbfa1a2a989c297 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 17 Aug 2009 09:30:18 +0000 Subject: #i101242# new print UI --- sw/source/core/view/vprint.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 351f1126103c..be9067d5bde6 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -979,11 +979,7 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, -<<<<<<< .mine const XubString* /*TLPDF pStr*/, ULONG /*TLPDF nMergeAct*/, ULONG /*TLPDF nMergeCnt*/ ) -======= - const XubString* /*pStr*/, ULONG /*nMergeAct*/, ULONG /*nMergeCnt*/ ) ->>>>>>> .r275036 { SET_CURR_SHELL( this ); -- cgit v1.2.3 From 50d636b6013f7429b28147531f27052e5e9ca6e8 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 17 Aug 2009 09:35:25 +0000 Subject: fixe merge conflict --- sw/source/core/view/vprint.cxx | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index be9067d5bde6..833ecb721657 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -443,52 +443,52 @@ bool SwPrintUIOptions::IsPrintRightPages() const { // take care of different property names for the option. // for compatibility the old name should win - + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); bool bRes = nLRPages == 0 || nLRPages == 2; bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ ); return bRes; } -bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const -{ +bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const +{ // take care of different property names for the option. - - bool bRes = bIsPDFExport ? - !getBoolValue( "IsSkipEmptyPages", sal_True ) : - getBoolValue( "PrintEmptyPages", sal_True ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintTables() const -{ + + bool bRes = bIsPDFExport ? + !getBoolValue( "IsSkipEmptyPages", sal_True ) : + getBoolValue( "PrintEmptyPages", sal_True ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintTables() const +{ // take care of different property names for the option. // for compatibility the old name should win - - bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); - bRes = getBoolValue( "PrintTables", bRes ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintGraphics() const -{ + + bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bRes = getBoolValue( "PrintTables", bRes ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintGraphics() const +{ // take care of different property names for the option. // for compatibility the old name should win - - bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); - bRes = getBoolValue( "PrintGraphics", bRes ); - return bRes; -} - -bool SwPrintUIOptions::IsPrintDrawings() const -{ + + bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bRes = getBoolValue( "PrintGraphics", bRes ); + return bRes; +} + +bool SwPrintUIOptions::IsPrintDrawings() const +{ // take care of different property names for the option. // for compatibility the old name should win - - bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); - bRes = getBoolValue( "PrintDDrawings", bRes ); - return bRes; -} + + bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bRes = getBoolValue( "PrintDrawings", bRes ); + return bRes; +} bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) { -- cgit v1.2.3 From b8dae601ca02cc4baa4d2a4ace860cfafd4edc94 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 17 Aug 2009 10:08:34 +0000 Subject: add missing exceptions --- sw/source/ui/uiview/makefile.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/ui/uiview/makefile.mk b/sw/source/ui/uiview/makefile.mk index 2aa5e12e2631..28ab2271a823 100644 --- a/sw/source/ui/uiview/makefile.mk +++ b/sw/source/ui/uiview/makefile.mk @@ -54,6 +54,7 @@ EXCEPTIONSFILES= \ $(SLO)$/uivwimp.obj \ $(SLO)$/view.obj \ $(SLO)$/view2.obj \ + $(SLO)$/viewprt.obj \ $(SLO)$/viewling.obj \ $(SLO)$/viewmdi.obj \ -- cgit v1.2.3 From 2982901c76e611e1305d68ea4aed4ee4ef546e87 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 17 Aug 2009 14:40:01 +0000 Subject: #i92516# fix several small issues (helpids, taborder, property names) --- sw/source/core/view/vprint.cxx | 68 +++++++++++++++++++++--------------------- sw/source/ui/config/optdlg.src | 2 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 833ecb721657..8648c2a463d8 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -314,6 +314,38 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aPaperTrayOpt ); + // print range selection + vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; + aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); + aPrintRangeOpt.mbInternalOnly = sal_True; + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ), + rtl::OUString(), + aPrintRangeOpt + ); + + // create a choice for the content to create + rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); + uno::Sequence< rtl::OUString > aChoices( 3 ); + uno::Sequence< rtl::OUString > aHelpText( 3 ); + aChoices[0] = aLocalizedStrings.GetString( 38 ); + aHelpText[0] = aLocalizedStrings.GetString( 39 ); + aChoices[1] = aLocalizedStrings.GetString( 40 ); + aHelpText[1] = aLocalizedStrings.GetString( 41 ); + aChoices[2] = aLocalizedStrings.GetString( 42 ); + aHelpText[2] = aLocalizedStrings.GetString( 43 ); + m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), + aHelpText, + aPrintRangeName, + aChoices, + 0 ); + // create a an Edit dependent on "Pages" selected + vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); + m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), + rtl::OUString(), + aPageRangeOpt + ); // print content selection vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); @@ -322,12 +354,12 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aContentsOpt ); // create a list box for notes content - uno::Sequence< rtl::OUString > aChoices( 4 ); + aChoices.realloc( 4 ); aChoices[0] = aLocalizedStrings.GetString( 21 ); aChoices[1] = aLocalizedStrings.GetString( 22 ); aChoices[2] = aLocalizedStrings.GetString( 23 ); aChoices[3] = aLocalizedStrings.GetString( 24 ); - uno::Sequence< rtl::OUString > aHelpText( 2 ); + aHelpText.realloc( 2 ); aHelpText[0] = aLocalizedStrings.GetString( 25 ); aHelpText[1] = aLocalizedStrings.GetString( 25 ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), @@ -384,38 +416,6 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aBrochureRTLOpt ); - // print range selection - vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; - aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); - aPrintRangeOpt.mbInternalOnly = sal_True; - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ), - rtl::OUString(), - aPrintRangeOpt - ); - - // create a choice for the content to create - rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); - aChoices.realloc( 3 ); - aHelpText.realloc( 3 ); - aChoices[0] = aLocalizedStrings.GetString( 38 ); - aHelpText[0] = aLocalizedStrings.GetString( 39 ); - aChoices[1] = aLocalizedStrings.GetString( 40 ); - aHelpText[1] = aLocalizedStrings.GetString( 41 ); - aChoices[2] = aLocalizedStrings.GetString( 42 ); - aHelpText[2] = aLocalizedStrings.GetString( 43 ); - m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), - aHelpText, - aPrintRangeName, - aChoices, - 0 ); - // create a an Edit dependent on "Pages" selected - vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); - m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), - rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), - rtl::OUString(), - aPageRangeOpt - ); DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 87bfc608ae41..0d5883390ff6 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -948,7 +948,7 @@ StringArray STR_PRINTOPTUI < "Specifies whether the graphics of your text document are printed"; >; < "Hidden te~xt"; >; < "Enable this option to print text that is marked as hidden."; >; - < "Text ~placeholder"; >; + < "~Text placeholder"; >; < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; < "Form control~s"; >; < "Specifies whether the form control fields of the text document are printed"; >; -- cgit v1.2.3 From 00eb1cf049970426333503731f6102909555b484 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 19 Aug 2009 07:32:06 +0000 Subject: #i101242# new print UI --- sw/inc/viewsh.hxx | 8 ++-- sw/source/core/view/viewpg.cxx | 17 +++++-- sw/source/core/view/vprint.cxx | 98 ++++++++++++++++++++++++----------------- sw/source/ui/dbui/dbmgr.cxx | 27 +++++++----- sw/source/ui/uiview/viewprt.cxx | 10 +++-- 5 files changed, 98 insertions(+), 62 deletions(-) diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 350a095b6a69..1e09bbde33de 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -96,7 +96,7 @@ class SdrPaintWindow; namespace vcl { - class PrinterController; + class OldStylePrintAdaptor; } @@ -382,11 +382,13 @@ public: // printing of a complete document for mail merge // bIsPDFExport == true is: do PDF Export (no printing!) - sal_Bool PrintOrPDFExportMM( const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + sal_Bool PrintOrPDFExportMM( vcl::OldStylePrintAdaptor &rAdaptor, + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rOptions, const SwPrtOptions &rPrintData, bool bIsPDFExport = sal_False ); // printing of a complete brochure for mail merge - void PrintProspectMM( const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + void PrintProspectMM( vcl::OldStylePrintAdaptor &rAdaptor, + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rOptions, const SwPrintData &rPrintData, bool bProspectRTL ); // printing for OLE 2.0 diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index fbcae6776d82..353e4483fd12 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -31,9 +31,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include #include #include +#include #include #include #include @@ -59,6 +61,10 @@ #include #include + +using namespace ::com::sun::star; + + // OD 12.12.2002 #103492# SwPagePreviewLayout* ViewShell::PagePreviewLayout() { @@ -449,13 +455,18 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, void ViewShell::PrintProspectMM( - const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + vcl::OldStylePrintAdaptor &rAdaptor, + const uno::Sequence< beans::PropertyValue > &rOptions, /* TLPDF: this or the above ? */ const SwPrintData & rPrintData, bool bProspectRTL ) { - (void) rpPrinterController; (void) rPrintData; (void) bProspectRTL; + (void) rOptions; (void) rAdaptor; (void) rPrintData; (void) bProspectRTL; + // to be removed (not needed) +#ifdef TL_NOT_NOW /* TLPDF */ - Printer::PrintJob( rpPrinterController, JobSetup() ); + const boost::shared_ptr< vcl::PrinterController > pPrtController( &rAdaptor ); + Printer::PrintJob( pPrtController, JobSetup() ); +#endif // TL_NOT_NOW /* TLPDF */ } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 8648c2a463d8..30ceb9f810eb 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -54,6 +55,12 @@ #include +#include +#include + +#include + +#include #include #include #include @@ -596,13 +603,6 @@ USHORT _PostItFld::GetPageNo( MultiSelection &rMulti, BOOL bRgt, BOOL bLft, return 0; } -/****************************************************************************** - * Methode : void lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds& ... - * Beschreibung: - * Erstellt : OK 07.11.94 10:20 - * Aenderung : - ******************************************************************************/ - void lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds& rSrtLst ) { @@ -627,13 +627,6 @@ void lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds& rSrtLst ) } } -/****************************************************************************** - * Methode : void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, ... - * Beschreibung: - * Erstellt : OK 07.11.94 10:20 - * Aenderung : - ******************************************************************************/ - void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItField* pField, USHORT nPageNo, USHORT nLineNo ) @@ -672,13 +665,6 @@ void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItF pIDCO->SplitNode( *aPam.GetPoint(), false ); } -/****************************************************************************** - * Methode : void lcl_PrintPostIts( ViewShell* pPrtShell ) - * Beschreibung: - * Erstellt : OK 07.11.94 10:21 - * Aenderung : MA 10. May. 95 - ******************************************************************************/ - void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, BOOL& rStartJob, int& rJobStartError, BOOL bReverse) @@ -739,13 +725,6 @@ void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, #endif } -/****************************************************************************** - * Methode : void lcl_PrintPostItsEndDoc( ViewShell* pPrtShell, ... - * Beschreibung: - * Erstellt : OK 07.11.94 10:21 - * Aenderung : MA 10. May. 95 - ******************************************************************************/ - void lcl_PrintPostItsEndDoc( ViewShell* pPrtShell, _SetGetExpFlds& rPostItFields, MultiSelection &rMulti, @@ -779,13 +758,6 @@ void lcl_PrintPostItsEndDoc( ViewShell* pPrtShell, lcl_PrintPostIts( pPrtShell, rJobName, rStartJob, rJobStartError, bRev ); } -/****************************************************************************** - * Methode : void lcl_PrintPostItsEndPage( ViewShell* pPrtShell, ... - * Beschreibung: - * Erstellt : OK 07.11.94 10:22 - * Aenderung : - ******************************************************************************/ - void lcl_PrintPostItsEndPage( ViewShell* pPrtShell, _SetGetExpFlds& rPostItFields, USHORT nPageNo, MultiSelection &rMulti, @@ -1241,15 +1213,59 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) sal_Bool ViewShell::PrintOrPDFExportMM( - const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, - const SwPrtOptions &rPrintData, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ - bool bIsPDFExport ) + vcl::OldStylePrintAdaptor &/*rAdaptor*/, + const uno::Sequence< beans::PropertyValue > &/*rOptions*/, /* TLPDF: this or the above ? */ + const SwPrtOptions &/*rPrintData*/, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ + bool /*bIsPDFExport*/ ) { - (void) rpPrinterController; (void) rPrintData; (void) bIsPDFExport; + return false; + // to be removed (not needed) +#ifdef TL_NOT_NOW /* TLPDF */ + (void) rPrintData; (void) bIsPDFExport; + + uno::Reference< frame::XModel > xModel( GetDoc()->GetDocShell()->GetModel() ); + uno::Reference< view::XRenderable > xTextDoc( xModel, uno::UNO_QUERY ); + if (!xModel.is() || xTextDoc.is()) + return sal_False; + + bool bRes = sal_True; + try + { + // print the whole document and not just a selection + uno::Any aSelection; + aSelection <<= xModel; + + const sal_Int32 nPages = xTextDoc->getRendererCount( aSelection, rOptions ); + for (sal_Int32 i = 0; i < nPages; ++i) + { + uno::Sequence< beans::PropertyValue > aRenderProps( xTextDoc->getRenderer( i, aSelection, rOptions ) ); + if (i == 0 || i == nPages - 1) + { + rtl::OUString aName( rtl::OUString::createFromAscii( i == 0 ? "IsFirstPage" : "IsLastPage" ) ); + const sal_Int32 nProps = aRenderProps.getLength(); + aRenderProps.realloc( nProps + 1 ); + aRenderProps[ nProps ].Name = aName; + aRenderProps[ nProps ].Value <<= sal_True; + } + rAdaptor.StartPage(); + xTextDoc->render( i, aSelection, aRenderProps ); + rAdaptor.EndPage(); + } + } + catch (uno::Exception &r) + { + (void) r; + bRes = sal_False; + } - Printer::PrintJob( rpPrinterController, JobSetup() ); - return sal_True; + if (bRes) + { + const boost::shared_ptr< vcl::PrinterController > pPrtController( &rAdaptor ); + Printer::PrintJob( pPrtController, JobSetup() ); + } + return bRes; +#endif // TL_NOT_NOW /* TLPDF */ } diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 62fe78702d1f..7c0991bd39fe 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -881,8 +881,9 @@ SwNewDBMgr::~SwNewDBMgr() BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) { - return TRUE; -#ifdef TL_NOT_NOW /*TLPDF*/ + DBG_ASSERT( 0, "not implemented" ); + return FALSE; +#ifdef TL_NOT_NOW /* TLPDF */ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section BOOL bSynchronizedDoc = pSh->IsLabelDoc() && pSh->GetSectionFmtCount() > 1; @@ -990,14 +991,14 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, } if( pPrt->IsJobActive() ) { - pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); /* TLPDF */ + pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspect_RTL() ); /* TLPDF */ bRet = TRUE; } #endif // TL_NOT_NOW /*TLPDF*/ - pSh->PrintProspectMM( pPrtController, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF + pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF bRet = TRUE; // TLPDF } - else if( pSh->PrintOrPDFExportMM( pPrtController, rOpt ) /* TLPDF */ ) + else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; @@ -1046,7 +1047,7 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, } return bRet; -#endif // TL_NOT_NOW /*TLPDF*/ +#endif // TL_NOT_NOW /* TLPDF */ } /*-- 21.06.2004 09:08:16--------------------------------------------------- @@ -1054,8 +1055,9 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) { - return TRUE; -#ifdef TL_NOT_NOW /*TLPDF*/ + DBG_ASSERT( 0, "not implemented" ); + return FALSE; +#ifdef TL_NOT_NOW /* TLPDF */ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section //merge source is already open @@ -1149,6 +1151,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, pAddViewProperties[0].Value <<= ::rtl::OUString( aTmp ); rView.SetAdditionalPrintOptions(aAddViewProperties); + // TLPDF: What abou this line ??? rView.SfxViewShell::Print( rProgress, bIsAPI ); // ggf Basic-Macro ausfuehren if( rOpt.IsPrintSingleJobs() && bRet ) { @@ -1161,11 +1164,11 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, { //TLPDF if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) //TLPDF { - pSh->PrintProspectMM( pPrtController, rOpt, rOpt.IsPrintProspect_RTL() ); - bRet = TRUE; + pSh->PrintProspectMM( aPrtAdaptor, aAddViewProperties, rOpt, rOpt.IsPrintProspect_RTL() ); + bRet = TRUE; //TLPDF } } - else if( pSh->PrintOrPDFExportMM( pPrtController, rOpt ) /* TLPDF */ ) + else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, aAddViewProperties, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; @@ -1209,7 +1212,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, } return bRet; -#endif // TL_NOT_NOW /*TLPDF*/ +#endif // TL_NOT_NOW /* TLPDF */ } diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 9d51c50ae19e..b6f2308d9888 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -178,6 +178,10 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, BOOL bIsAPI ) { + (void) pPrinter; (void) pDlg; (void) bSilent; (void) bIsAPI; + DBG_ASSERT( 0, "not implemented" ); + return 0; +#ifdef TL_NOT_NOW /* TLPDF */ // First test SwWrtShell* pSh = &GetWrtShell(); SwNewDBMgr* pMgr = pSh->GetNewDBMgr(); @@ -393,16 +397,15 @@ ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, { const boost::shared_ptr< Printer > pPrt( pPrinter ); // TLPDF vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF - const boost::shared_ptr< vcl::PrinterController > pPrtController( &aPrtAdaptor ); if( bPrtPros ) { //TLPDF bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); //TLPDF if( bStartJob ) - pSh->PrintProspectMM( pPrtController, aOpts, bPrtPros_RTL ); /* TLPDF */ + pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, aOpts, bPrtPros_RTL ); /* TLPDF */ } else - bStartJob = pSh->PrintOrPDFExportMM( pPrtController, aOpts ); /*TLPDF*/ + bStartJob = pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, aOpts ); /*TLPDF*/ if ( bBrowse ) { @@ -444,6 +447,7 @@ ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, //TLPDF pProgress->DeleteOnEndPrint(); //TLPDF pPrinter->EndJob(); return pPrinter->GetError(); +#endif // TL_NOT_NOW /* TLPDF */ } -- cgit v1.2.3 From 9e095aec061c14b180f88bd5d7b2ea6bef19d4f9 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 21 Aug 2009 06:14:34 +0000 Subject: #i101242# new print UI in sw --- sw/inc/doc.hxx | 7 +- sw/inc/printdata.hxx | 73 ++++++--- sw/source/core/doc/doc.cxx | 254 ++++++++++++++++++++++++++++++- sw/source/core/view/vprint.cxx | 333 +++++++++-------------------------------- sw/source/ui/uno/unotxdoc.cxx | 81 +++++----- 5 files changed, 423 insertions(+), 325 deletions(-) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index d2ec00c8ad0c..b9726a08ee4b 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -219,6 +219,7 @@ class SwChartLockController_Helper; class IGrammarContact; class SwPrintData; class SwPageFrm; +class SwViewOption; namespace sw { namespace mark { class MarkManager; @@ -1336,9 +1337,11 @@ public: // get the set of printable pages for the XRenderable API by // evaluating the respective settings (see implementation) - void CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rOptions, + void CalculatePagesForPrinting( /* out */ SwPrintUIOptions &rOptions, bool bIsPDFExport, sal_Int32 nDocPageCount ); - void CalculatePagePairsForProspectPrinting( SwPrintUIOptions &rOptions, + void UpdatePagesForPrintingWithPostItData( /* out */ SwPrintUIOptions &rOptions, bool bIsPDFExport, + sal_Int32 nDocPageCount ); + void CalculatePagePairsForProspectPrinting( /* out */ SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ); sal_uInt16 GetPageCount() const; diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 3ff07102733a..ed463a6cb28c 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -41,6 +41,12 @@ #include class SwPageFrm; +class SwDoc; +class ViewShell; +class _SetGetExpFlds; +class SwViewOption; +class OutputDevice; + //////////////////////////////////////////////////////////// @@ -51,16 +57,28 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper // pages valid for printing (according to the current settings) // and their respective start frames (see getRendererCount in unotxdoc.cxx) // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! - std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) - std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages + std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) + std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrms; // the map of start frames for those pages // vector of pages and their order to be printed (duplicates and any order allowed!) // (see 'render' in unotxdoc.cxx) - std::vector< sal_Int32 > aPagesToPrint; + std::vector< sal_Int32 > m_aPagesToPrint; + + std::vector< const SwPageFrm * > m_aPostItStartFrame; // for prospect printing: the pairs of pages to be printed together on a single prospect page. // -1 indicates a half page to be left empty. - std::vector< std::pair< sal_Int32, sal_Int32 > > aPagePairs; + std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs; + + rtl::OUString m_PageRange; + +public: + + // PostIt relevant data + _SetGetExpFlds * m_pPostItFields; + SwDoc * m_pPostItDoc; + ViewShell * m_pPostItShell; + public: SwPrintUIOptions( BOOL bWeb = FALSE ); @@ -68,28 +86,47 @@ public: bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; + bool IsPrintEmptyPages( bool bIsPDFExport ) const; + bool IsPrintTables() const; + bool IsPrintGraphics() const; + bool IsPrintDrawings() const; + + bool HasPostItData() const { return m_pPostItShell != 0 && m_pPostItDoc != 0 && m_pPostItShell != 0; } + void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ); + void DeletePostItData(); + typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; - std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } - const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } - ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } - const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } + std::set< sal_Int32 > & GetValidPagesSet() { return m_aValidPages; } + const std::set< sal_Int32 > & GetValidPagesSet() const { return m_aValidPages; } + ValidStartFramesMap_t & GetValidStartFrms() { return m_aValidStartFrms; } + const ValidStartFramesMap_t & GetValidStartFrms() const { return m_aValidStartFrms; } // used for 'normal' printing - std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } - const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } + // A page value of 0 as entry indicates that this page is not from the document but + // from the post-it document. (See also GetPostItStartFrame below) + std::vector< sal_Int32 > & GetPagesToPrint() { return m_aPagesToPrint; } + const std::vector< sal_Int32 > & GetPagesToPrint() const { return m_aPagesToPrint; } + + // used for 'normal' printing with post-its + // - if the vector entry will be NULL then the respective page to be printed is from + // the document. In that case use the value from GetPagesToPrint at the same index to + // get the phys. page number to be printed, and then retrieve the start frame to use + // from GetValidStartFrms. + // - If the entry is not NULL it is the start frame of the page from the post-it document + // that is to be printed + std::vector< const SwPageFrm * > & GetPostItStartFrame() { return m_aPostItStartFrame; } + const std::vector< const SwPageFrm * > & GetPostItStartFrame() const { return m_aPostItStartFrame; } // used for prospect printing only - PagePairsVec_t & GetPagePairsForProspectPrinting() { return aPagePairs; } - const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return aPagePairs; } + PagePairsVec_t & GetPagePairsForProspectPrinting() { return m_aPagePairs; } + const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return m_aPagePairs; } - bool IsPrintLeftPages() const; - bool IsPrintRightPages() const; - bool IsPrintEmptyPages( bool bIsPDFExport ) const; - bool IsPrintTables() const; - bool IsPrintGraphics() const; - bool IsPrintDrawings() const; + rtl::OUString GetPageRange() const { return m_PageRange; } + void SetPageRange( const rtl::OUString &rRange ) { m_PageRange = rRange; } }; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index ca02f3e2eb30..2abd783cc9f6 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -58,6 +58,8 @@ #include #include #include +#include + #include #include #include @@ -105,6 +107,12 @@ #include #include #include +#include // _SetGetExpFld +#include // SwPostItField +#include +#include +#include + #include #include @@ -118,6 +126,8 @@ // <-- using namespace ::com::sun::star; +using ::rtl::OUString; + // Seiten-Deskriptoren SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr); @@ -990,10 +1000,132 @@ const SwDocStat& SwDoc::GetDocStat() const return *pDocStat; } +/*************************************************************************/ + + +struct _PostItFld : public _SetGetExpFld +{ + _PostItFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld, const SwIndex* pIdx = 0 ) + : _SetGetExpFld( rNdIdx, pFld, pIdx ) {} + + USHORT GetPageNo( const StringRangeEnumerator &rRangeEnum, + const std::set< sal_Int32 > &rPossiblePages, + BOOL bRgt, BOOL bLft, + USHORT& rVirtPgNo, USHORT& rLineNo ); + + SwPostItField* GetPostIt() const + { + return (SwPostItField*) GetFld()->GetFld().GetFld(); + } +}; + + +USHORT _PostItFld::GetPageNo( + const StringRangeEnumerator &rRangeEnum, + const std::set< sal_Int32 > &rPossiblePages, + BOOL bRgt, BOOL bLft, /* TLPDF both should not be needed since rMulti should only include the correct pages as stored in GetValidPagesSet */ + /* out */ USHORT& rVirtPgNo, /* out */ USHORT& rLineNo ) +{ + //Problem: Wenn ein PostItFld in einem Node steht, der von mehr als + //einer Layout-Instanz repraesentiert wird, steht die Frage im Raum, + //ob das PostIt nur ein- oder n-mal gedruck werden soll. + //Wahrscheinlich nur einmal, als Seitennummer soll hier keine Zufaellige + //sondern die des ersten Auftretens des PostIts innerhalb des selektierten + //Bereichs ermittelt werden. + rVirtPgNo = 0; + USHORT nPos = GetCntnt(); + SwClientIter aIter( (SwModify &)GetFld()->GetTxtNode() ); + for( SwTxtFrm* pFrm = (SwTxtFrm*)aIter.First( TYPE( SwFrm )); + pFrm; pFrm = (SwTxtFrm*)aIter.Next() ) + { + if( pFrm->GetOfst() > nPos || + (pFrm->HasFollow() && pFrm->GetFollow()->GetOfst() <= nPos) ) + continue; + USHORT nPgNo = pFrm->GetPhyPageNum(); + BOOL bRight = pFrm->OnRightPage(); + if( rRangeEnum.hasValue( nPgNo, &rPossiblePages ) && + ( (bRight && bRgt) || (!bRight && bLft) ) ) + { + rLineNo = (USHORT)(pFrm->GetLineCount( nPos ) + + pFrm->GetAllLines() - pFrm->GetThisLines()); + rVirtPgNo = pFrm->GetVirtPageNum(); + return nPgNo; + } + } + return 0; +} + + +void lcl_GetPostIts( + IDocumentFieldsAccess* pIDFA, + _SetGetExpFlds& rSrtLst ) +{ + SwFieldType* pFldType = pIDFA->GetSysFldType( RES_POSTITFLD ); + DBG_ASSERT( pFldType, "kein PostItType ? "); + + if( pFldType->GetDepends() ) + { + // Modify-Object gefunden, trage alle Felder ins Array ein + SwClientIter aIter( *pFldType ); + SwClient* pLast; + const SwTxtFld* pTxtFld; + + for( pLast = aIter.First( TYPE(SwFmtFld)); pLast; pLast = aIter.Next() ) + if( 0 != ( pTxtFld = ((SwFmtFld*)pLast)->GetTxtFld() ) && + pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) + { + SwNodeIndex aIdx( pTxtFld->GetTxtNode() ); + _PostItFld* pNew = new _PostItFld( aIdx, pTxtFld ); + rSrtLst.Insert( pNew ); + } + } +} + + +static void lcl_FormatPostIt( + IDocumentContentOperations* pIDCO, + SwPaM& aPam, + SwPostItField* pField, + USHORT nPageNo, USHORT nLineNo ) +{ + static char __READONLY_DATA sTmp[] = " : "; + + DBG_ASSERT( ViewShell::GetShellRes(), "missing ShellRes" ); + + String aStr( ViewShell::GetShellRes()->aPostItPage ); + aStr.AppendAscii(sTmp); + + aStr += XubString::CreateFromInt32( nPageNo ); + aStr += ' '; + if( nLineNo ) + { + aStr += ViewShell::GetShellRes()->aPostItLine; + aStr.AppendAscii(sTmp); + aStr += XubString::CreateFromInt32( nLineNo ); + aStr += ' '; + } + aStr += ViewShell::GetShellRes()->aPostItAuthor; + aStr.AppendAscii(sTmp); + aStr += pField->GetPar1(); + aStr += ' '; + aStr += GetAppLocaleData().getDate( pField->GetDate() ); + pIDCO->Insert( aPam, aStr, true ); + + pIDCO->SplitNode( *aPam.GetPoint(), false ); + aStr = pField->GetPar2(); +#if defined( WIN ) || defined( WNT ) || defined( PM2 ) + // Bei Windows und Co alle CR rausschmeissen + aStr.EraseAllChars( '\r' ); +#endif + pIDCO->Insert( aPam, aStr, true ); + pIDCO->SplitNode( *aPam.GetPoint(), false ); + pIDCO->SplitNode( *aPam.GetPoint(), false ); +} + void SwDoc::CalculatePagesForPrinting( + /* out */ SwPrintUIOptions &rOptions, bool bIsPDFExport, - SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { DBG_ASSERT( pLayout, "no layout present" ); @@ -1116,6 +1248,121 @@ void SwDoc::CalculatePagesForPrinting( } } } + + + // + // now that we have identified the valid pages for printing according + // to the print settings we need to get the PageRange to use and + // use both results to get the actual pages to be printed + // (post-it settings need to be taken into account later on!) + // + + // get PageRange value to use + OUString aPageRange; + if (bIsPDFExport) + { +// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); + aPageRange = rOptions.getStringValue( "PageRange", OUString() ); + } + else + { + // PageContent : + // 0 -> print all pages + // 1 -> print range according to PageRange + // 2 -> print selection + if (1 == rOptions.getIntValue( "PrintContent", 0 )) + aPageRange = rOptions.getStringValue( "PageRange", OUString() ); + } + if (aPageRange.getLength() == 0) // empty string -> print all + { + // set page range to print to 'all pages' + aPageRange = OUString::valueOf( (sal_Int32)1 ); + aPageRange += OUString::valueOf( (sal_Unicode)'-'); + aPageRange += OUString::valueOf( nDocPageCount ); + } + rOptions.SetPageRange( aPageRange ); + + // get vector of pages to print according to PageRange and valid pages set from above + // (result may be an empty vector, for example if the range string is not correct) + StringRangeEnumerator::getRangesFromString( + aPageRange, rOptions.GetPagesToPrint(), + 1, nDocPageCount, 0, &rOptions.GetValidPagesSet() ); +} + + +void SwDoc::UpdatePagesForPrintingWithPostItData( + /* out */ SwPrintUIOptions &rOptions, + bool bIsPDFExport, + sal_Int32 nDocPageCount ) +{ + + sal_Int16 nPostItMode = (sal_Int16) rOptions.getIntValue( "PrintAnnotationMode", 0 ); + DBG_ASSERT(nPostItMode == POSTITS_NONE || rOptions.HasPostItData(), + "print post-its without post-it data?" ); + const USHORT nPostItCount = rOptions.HasPostItData() ? rOptions.m_pPostItFields->Count() : 0; + if (nPostItMode != POSTITS_NONE && nPostItCount > 0) + { + SET_CURR_SHELL( rOptions.m_pPostItShell ); + + // clear document and move to end of it + SwPaM aPam( rOptions.m_pPostItDoc->GetNodes().GetEndOfContent() ); + aPam.Move( fnMoveBackward, fnGoDoc ); + aPam.SetMark(); + aPam.Move( fnMoveForward, fnGoDoc ); + rOptions.m_pPostItDoc->Delete( aPam ); + + const StringRangeEnumerator aRangeEnum( rOptions.GetPageRange(), 1, nDocPageCount, 0 ); + + USHORT nVirtPg = 0, nLineNo = 0; + for (USHORT i = 0; i < nPostItCount; ++i) + { + _PostItFld& rPostIt = (_PostItFld&)*(*rOptions.m_pPostItFields)[ i ]; + const USHORT nPhyPageNum = rPostIt.GetPageNo( + aRangeEnum, rOptions.GetValidPagesSet(), + true /*TLPDF bRgt*/, true /*TLPDF bLft*/, nVirtPg, nLineNo ); + if (nPhyPageNum) + lcl_FormatPostIt( rOptions.m_pPostItShell->GetDoc(), aPam, + rPostIt.GetPostIt(), nVirtPg, nLineNo ); + } + + // format post-it doc to get correct number of pages + rOptions.m_pPostItShell->CalcLayout(); + const sal_Int32 nPostItDocPageCount = rOptions.m_pPostItDoc->GetPageCount(); + + // now add those post-it pages to the vector of pages to print + // or replace them if only post-its should be printed + if (nPostItMode == POSTITS_ONLY || nPostItMode == POSTITS_ENDDOC) + { + rOptions.GetPostItStartFrame().clear(); + if (nPostItMode == POSTITS_ENDDOC) + { + // set all values up to number of pages to print currently known to NULL, + // meaning none of the pages currently in the vector is from the + // post-it document, they are the documents pages. + rOptions.GetPostItStartFrame().resize( rOptions.GetPagesToPrint().size() ); + } + else if (nPostItMode == POSTITS_ONLY) + { + // no document page to be printed + rOptions.GetPagesToPrint().clear(); + } + + // now we just need to add the post-it pages to be printed to the end + // of the vector of pages to print and keep the GetPostItStartFrame + // data conform with it + sal_Int32 nPageNum = 0; + const SwPageFrm *pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); + while( pPageFrm && nPageNum < nPostItDocPageCount ) + { + DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); + ++nPageNum; + rOptions.GetPagesToPrint().push_back( 0 ); // a page number of 0 indicates this page is from the post-it doc + rOptions.GetPostItStartFrame().push_back( pPageFrm ); + pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); + } + DBG_ASSERT( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); + } + } } @@ -1151,7 +1398,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( const SwPageFrm *pPageFrm = (SwPageFrm*)pLayout->Lower(); while( pPageFrm && nPageNum < nDocPageCount ) { - DBG_ASSERT( pPageFrm, "Empty page frame. How are we gpoing to print this?" ); + DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); ++nPageNum; rValidPagesSet.insert( nPageNum ); rValidStartFrms[ nPageNum ] = pPageFrm; @@ -1281,6 +1528,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( nEPg = nEPg - nStep; } DBG_ASSERT( size_t(nCntPage) == rPagePairs.size(), "size mismatch for number of page pairs" ); + + // luckily prospect printing does not make use of post-its so far, + // thus we are done here. } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 30ceb9f810eb..8e647db8fff7 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -75,8 +75,8 @@ #include #include #include -#include // PostItFld /-Type #include // _SetGetExpFld +#include // PostItFld /-Type #include #include #include // SwPrtOptions @@ -98,6 +98,9 @@ #define JOBSET_ERR_ISSTARTET 2 +extern void lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds& rSrtLst ); + + using namespace ::com::sun::star; //-------------------------------------------------------------------- @@ -425,6 +428,10 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); + + m_pPostItFields = 0; + m_pPostItDoc = 0; + m_pPostItShell = 0; } @@ -519,6 +526,35 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un } +void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) +{ + m_pPostItFields = new _SetGetExpFlds; + lcl_GetPostIts( pDoc, *m_pPostItFields ); + m_pPostItDoc = new SwDoc; + + //!! Disable spell and grammar checking in the temporary document. + //!! Otherwise the grammar checker might process it and crash if we later on + //!! simply delete this document while he is still at it. + SwViewOption aViewOpt( *pViewOpt ); + aViewOpt.SetOnlineSpell( FALSE ); + + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); +} + + +void SwPrintUIOptions::DeletePostItData() +{ + if (HasPostItData()) + { + m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt + delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. + delete m_pPostItFields; + m_pPostItDoc = 0; + m_pPostItShell = 0; + m_pPostItFields = 0; + } +} + /****************************************************************************** * Methode : void SetSwVisArea( ViewShell *pSh, Point aPrtOffset, ... * Beschreibung: @@ -551,255 +587,6 @@ void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL /*bPDFExport*/ ) pOut->SetMapMode( aMapMode ); } -/****************************************************************************** - * Methode : struct _PostItFld : public _SetGetExpFld - * Beschreibung: Update an das PostItFeld - * Erstellt : OK 07.11.94 10:18 - * Aenderung : - ******************************************************************************/ -struct _PostItFld : public _SetGetExpFld -{ - _PostItFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld, - const SwIndex* pIdx = 0 ) - : _SetGetExpFld( rNdIdx, pFld, pIdx ) {} - - USHORT GetPageNo( MultiSelection &rMulti, BOOL bRgt, BOOL bLft, - USHORT& rVirtPgNo, USHORT& rLineNo ); - SwPostItField* GetPostIt() const - { return (SwPostItField*) GetFld()->GetFld().GetFld(); } -}; - - - -USHORT _PostItFld::GetPageNo( MultiSelection &rMulti, BOOL bRgt, BOOL bLft, - USHORT& rVirtPgNo, USHORT& rLineNo ) -{ - //Problem: Wenn ein PostItFld in einem Node steht, der von mehr als - //einer Layout-Instanz repraesentiert wird, steht die Frage im Raum, - //ob das PostIt nur ein- oder n-mal gedruck werden soll. - //Wahrscheinlich nur einmal, als Seitennummer soll hier keine Zufaellige - //sondern die des ersten Auftretens des PostIts innerhalb des selektierten - //Bereichs ermittelt werden. - rVirtPgNo = 0; - USHORT nPos = GetCntnt(); - SwClientIter aIter( (SwModify &)GetFld()->GetTxtNode() ); - for( SwTxtFrm* pFrm = (SwTxtFrm*)aIter.First( TYPE( SwFrm )); - pFrm; pFrm = (SwTxtFrm*)aIter.Next() ) - { - if( pFrm->GetOfst() > nPos || - (pFrm->HasFollow() && pFrm->GetFollow()->GetOfst() <= nPos) ) - continue; - USHORT nPgNo = pFrm->GetPhyPageNum(); - BOOL bRight = pFrm->OnRightPage(); - if( rMulti.IsSelected( nPgNo ) && - ( (bRight && bRgt) || (!bRight && bLft) ) ) - { - rLineNo = (USHORT)(pFrm->GetLineCount( nPos ) + - pFrm->GetAllLines() - pFrm->GetThisLines()); - rVirtPgNo = pFrm->GetVirtPageNum(); - return nPgNo; - } - } - return 0; -} - - -void lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds& rSrtLst ) -{ - SwFieldType* pFldType = pIDFA->GetSysFldType( RES_POSTITFLD ); - ASSERT( pFldType, "kein PostItType ? "); - - if( pFldType->GetDepends() ) - { - // Modify-Object gefunden, trage alle Felder ins Array ein - SwClientIter aIter( *pFldType ); - SwClient* pLast; - const SwTxtFld* pTxtFld; - - for( pLast = aIter.First( TYPE(SwFmtFld)); pLast; pLast = aIter.Next() ) - if( 0 != ( pTxtFld = ((SwFmtFld*)pLast)->GetTxtFld() ) && - pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) - { - SwNodeIndex aIdx( pTxtFld->GetTxtNode() ); - _PostItFld* pNew = new _PostItFld( aIdx, pTxtFld ); - rSrtLst.Insert( pNew ); - } - } -} - - -void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItField* pField, - USHORT nPageNo, USHORT nLineNo ) -{ - static char __READONLY_DATA sTmp[] = " : "; - - ASSERT( ViewShell::GetShellRes(), "missing ShellRes" ); - - String aStr( ViewShell::GetShellRes()->aPostItPage ); - aStr.AppendAscii(sTmp); - - aStr += XubString::CreateFromInt32( nPageNo ); - aStr += ' '; - if( nLineNo ) - { - aStr += ViewShell::GetShellRes()->aPostItLine; - aStr.AppendAscii(sTmp); - aStr += XubString::CreateFromInt32( nLineNo ); - aStr += ' '; - } - aStr += ViewShell::GetShellRes()->aPostItAuthor; - aStr.AppendAscii(sTmp); - aStr += pField->GetPar1(); - aStr += ' '; - aStr += GetAppLocaleData().getDate( pField->GetDate() ); - pIDCO->Insert( aPam, aStr, true ); - - pIDCO->SplitNode( *aPam.GetPoint(), false ); - aStr = pField->GetPar2(); -#if defined( WIN ) || defined( WNT ) || defined( PM2 ) - // Bei Windows und Co alle CR rausschmeissen - aStr.EraseAllChars( '\r' ); -#endif - pIDCO->Insert( aPam, aStr, true ); - pIDCO->SplitNode( *aPam.GetPoint(), false ); - pIDCO->SplitNode( *aPam.GetPoint(), false ); -} - - -void lcl_PrintPostIts( ViewShell* pPrtShell, const XubString& rJobName, - BOOL& rStartJob, int& rJobStartError, BOOL bReverse) -{ -#ifdef TL_NOT_NOW /* TLPDF ??? */ - // Formatieren und Ausdrucken - pPrtShell->CalcLayout(); - - SfxPrinter* pPrn = pPrtShell->getIDocumentDeviceAccess()->getPrinter( false ); - - //Das Druckdokument ist ein default Dokument, mithin arbeitet es auf der - //StandardSeite. - SwFrm *pPage = pPrtShell->GetLayout()->Lower(); - - SwPrtOptSave aPrtSave( pPrn ); - - pPrn->SetOrientation( ORIENTATION_PORTRAIT ); - pPrn->SetPaperBin( pPage->GetAttrSet()->GetPaperBin().GetValue() ); - - if( !rStartJob && JOBSET_ERR_DEFAULT == rJobStartError && - rJobName.Len() ) - { - if( !pPrn->IsJobActive() ) - { - rStartJob = pPrn->StartJob( rJobName ); - if( !rStartJob ) - { - rJobStartError = JOBSET_ERR_ERROR; - return; - } - } - pPrtShell->InitPrt( pPrn ); - rJobStartError = JOBSET_ERR_ISSTARTET; - } - - // Wir koennen auch rueckwaerts: - if ( bReverse ) - pPage = pPrtShell->GetLayout()->GetLastPage(); - - while( pPage ) - { - //Mag der Anwender noch?, Abbruch erst in Prt() - GetpApp()->Reschedule(); - ::SetSwVisArea( pPrtShell, pPage->Frm() ); - pPrn->StartPage(); - pPage->GetUpper()->Paint( pPage->Frm() ); -// SFX_APP()->SpoilDemoOutput( *pPrtShell->GetOut(), pPage->Frm().SVRect()); - SwPaintQueue::Repaint(); - pPrn->EndPage(); - pPage = bReverse ? pPage->GetPrev() : pPage->GetNext(); - } -#else -(void)pPrtShell; -(void)rJobName; -(void)rStartJob; -(void)rJobStartError; -(void)bReverse; -#endif -} - - -void lcl_PrintPostItsEndDoc( ViewShell* pPrtShell, - _SetGetExpFlds& rPostItFields, MultiSelection &rMulti, - const XubString& rJobName, BOOL& rStartJob, int& rJobStartError, - BOOL bRgt, BOOL bLft, BOOL bRev ) -{ - USHORT nPostIts = rPostItFields.Count(); - if( !nPostIts ) - // Keine Arbeit - return; - - SET_CURR_SHELL( pPrtShell ); - - SwDoc* pPrtDoc = pPrtShell->GetDoc(); - - // Dokument leeren und ans Dokumentende gehen - SwPaM aPam( pPrtDoc->GetNodes().GetEndOfContent() ); - aPam.Move( fnMoveBackward, fnGoDoc ); - aPam.SetMark(); - aPam.Move( fnMoveForward, fnGoDoc ); - pPrtDoc->Delete( aPam ); - - for( USHORT i = 0, nVirtPg, nLineNo; i < nPostIts; ++i ) - { - _PostItFld& rPostIt = (_PostItFld&)*rPostItFields[ i ]; - if( rPostIt.GetPageNo( rMulti, bRgt, bLft, nVirtPg, nLineNo ) ) - lcl_FormatPostIt( pPrtShell->GetDoc(), aPam, - rPostIt.GetPostIt(), nVirtPg, nLineNo ); - } - - lcl_PrintPostIts( pPrtShell, rJobName, rStartJob, rJobStartError, bRev ); -} - - -void lcl_PrintPostItsEndPage( ViewShell* pPrtShell, - _SetGetExpFlds& rPostItFields, USHORT nPageNo, MultiSelection &rMulti, - const XubString& rJobName, BOOL& rStartJob, int& rJobStartError, - BOOL bRgt, BOOL bLft, BOOL bRev ) -{ - USHORT nPostIts = rPostItFields.Count(); - if( !nPostIts ) - // Keine Arbeit - return; - - SET_CURR_SHELL( pPrtShell ); - - USHORT i = 0, nVirtPg, nLineNo; - while( ( i < nPostIts ) && - ( nPageNo != ((_PostItFld&)*rPostItFields[ i ]). - GetPageNo( rMulti,bRgt, bLft, nVirtPg, nLineNo ))) - ++i; - if(i == nPostIts) - // Nix zu drucken - return; - - SwDoc* pPrtDoc = pPrtShell->GetDoc(); - - // Dokument leeren und ans Dokumentende gehen - SwPaM aPam( pPrtDoc->GetNodes().GetEndOfContent() ); - aPam.Move( fnMoveBackward, fnGoDoc ); - aPam.SetMark(); - aPam.Move( fnMoveForward, fnGoDoc ); - pPrtDoc->Delete( aPam ); - - while( i < nPostIts ) - { - _PostItFld& rPostIt = (_PostItFld&)*rPostItFields[ i ]; - if( nPageNo == rPostIt.GetPageNo( rMulti, bRgt, bLft, nVirtPg, nLineNo ) ) - lcl_FormatPostIt( pPrtShell->GetDoc(), aPam, - rPostIt.GetPostIt(), nVirtPg, nLineNo ); - ++i; - } - lcl_PrintPostIts( pPrtShell, rJobName, rStartJob, rJobStartError, bRev ); -} - /****************************************************************************** * Methode : void ViewShell::InitPrt( Printer *pNew, OutputDevice *pPDFOut ) * Beschreibung: @@ -1375,16 +1162,26 @@ sal_Bool ViewShell::PrintOrPDFExport( #endif const sal_Int32 nPage = rPrintData.GetPrintUIOptions().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( rPrintData.GetPrintUIOptions().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); + DBG_ASSERT( nPage == 0 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); - SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); - DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); - const SwPageFrm *pStPage = aIt->second; + const SwPageFrm *pStPage = 0; + if (nPage > 0) // a 'regular' page, not one from the post-it document + { + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); + SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + pStPage = aIt->second; + } + else // a page from the post-its document ... + { + DBG_ASSERT( nPage == 0, "unexpected page number. 0 for post-it pages expected" ); + pStPage = rPrintData.GetPrintUIOptions().GetPostItStartFrame()[ nRenderer ]; + } + DBG_ASSERT( pStPage, "failed to get start page" ); /* TLPDF neu: end */ - // ben�tigte Seiten fuers Drucken formatieren + // benoetigte Seiten fuers Drucken formatieren pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, pStr, 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); @@ -1435,6 +1232,7 @@ sal_Bool ViewShell::PrintOrPDFExport( _SetGetExpFlds aPostItFields; SwDoc* pPostItDoc = 0; ViewShell* pPostItShell = 0; +#ifdef TL_NOT_NOW /*TLPDF*/ if( rPrintData.nPrintPostIts != POSTITS_NONE ) { lcl_GetPostIts( pDoc, aPostItFields ); @@ -1454,6 +1252,7 @@ sal_Bool ViewShell::PrintOrPDFExport( rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, TRUE ); } +#endif // TL_NOT_NOW /*TLPDF*/ // aOldMapMode wird fuer das Drucken von Umschlaegen gebraucht. MapMode aOldMapMode; @@ -1463,11 +1262,14 @@ sal_Bool ViewShell::PrintOrPDFExport( // BOOL bSetPaperSz = FALSE; BOOL bSetPrt = FALSE; - if ( rPrintData.nPrintPostIts != POSTITS_ONLY ) +//TLPDF if ( rPrintData.nPrintPostIts != POSTITS_ONLY ) { //TLPDF while( pStPage && !bStop ) { - ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); + if (nPage == 0) // post-it page + ::SetSwVisArea( rPrintData.GetPrintUIOptions().m_pPostItShell , pStPage->Frm() ); + else + ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // wenn wir einen Umschlag drucken wird ein Offset beachtet if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) @@ -1528,6 +1330,7 @@ sal_Bool ViewShell::PrintOrPDFExport( } } +#ifdef TL_NOT_NOW /*TLPDF*/ // Wenn PostIts nach Seite gedruckt werden sollen, // jedoch Reverse eingestellt ist ... if( rPrintData.bPrintReverse && @@ -1536,16 +1339,20 @@ sal_Bool ViewShell::PrintOrPDFExport( nPage /* TLPDF nPageNo*/, aMulti, sJobName, bStartJob, nJobStartError, rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, rPrintData.bPrintReverse ); +#endif // TL_NOT_NOW /*TLPDF*/ - if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError - && sJobName.Len() ) +// TLPDF if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError +// TLPDF && sJobName.Len() ) { // TLPDF pShell->InitPrt( pOutDev, bIsPDFExport ? pOutDev : 0 ); pShell->InitPrt( pOutDev ); - ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // TLPDF + if (nPage == 0) // post-it page + ::SetSwVisArea( rPrintData.GetPrintUIOptions().m_pPostItShell , pStPage->Frm() ); + else + ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages @@ -1556,6 +1363,7 @@ sal_Bool ViewShell::PrintOrPDFExport( } SwPaintQueue::Repaint(); +#ifdef TL_NOT_NOW /*TLPDF*/ // Wenn PostIts nach Seite gedruckt werden sollen ... if( (!rPrintData.bPrintReverse) && rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) @@ -1563,6 +1371,7 @@ sal_Bool ViewShell::PrintOrPDFExport( nPage /* TLPDF nPageNo */, aMulti, sJobName, bStartJob, nJobStartError, rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, rPrintData.bPrintReverse ); +#endif // TL_NOT_NOW /*TLPDF*/ } // den eventl. fuer Umschlaege modifizierte OutDevOffset wieder @@ -1573,6 +1382,7 @@ sal_Bool ViewShell::PrintOrPDFExport( } // TLPDF loop end: while( pStPage && !bStop ) } +#ifdef TL_NOT_NOW /*TLPDF*/ if (!bStop) // TLPDF: see break above { // Wenn PostIts am Dokumentenende gedruckt werden sollen, dann hier machen @@ -1592,6 +1402,7 @@ sal_Bool ViewShell::PrintOrPDFExport( //TLPDF if( bStartJob ) //TLPDF rPrintData.bJobStartet = TRUE; } // TLPDF: if (!bStop) see break above +#endif // TL_NOT_NOW /*TLPDF*/ } delete pStr; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index aa50d3f71372..f93d3c9400ef 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2544,6 +2544,24 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() /* -----------------------------23.08.02 16:00-------------------------------- ---------------------------------------------------------------------------*/ + +static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions ) +{ + OutputDevice *pOut = 0; + + uno::Any aAny( rPrintUIOptions.getValue( C2U( "RenderDevice" ) )); + uno::Reference< awt::XDevice > xRenderDevice; + aAny >>= xRenderDevice; + if (xRenderDevice.is()) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + pOut = pDevice ? pDevice->GetOutputDevice() : 0; + } + + return pOut; +} + + /* * GetRenderDoc: * returns the document to be rendered, usually this will be the 'regular' @@ -2656,31 +2674,9 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const sal_Int32 nPageCount = pDoc->GetPageCount(); - // get PageRange value to use - OUString aPageRange; - if (bIsPDFExport) - { -// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); - aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); - } - else - { - // PageContent : - // 0 -> print all pages - // 1 -> print range according to PageRange - // 2 -> print selection - if (1 == m_pPrintUIOptions->getIntValue( "PrintContent", 0 )) - aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); - } - if (aPageRange.getLength() == 0) // empty string -> print all - { - // set page range to print to 'all pages' - aPageRange = OUString::valueOf( (sal_Int32)1 ); - aPageRange += OUString::valueOf( (sal_Unicode)'-'); - aPageRange += OUString::valueOf( nPageCount ); - } - + // // get number of pages to be rendered + // const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); if (bPrintProspect) { @@ -2689,16 +2685,22 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } else { - // get set of valid pages (according to the current settings) + const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); + if (nPostItMode != POSTITS_NONE) + { + OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + m_pPrintUIOptions->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev ); + } + + // get set of valid document pages (according to the current settings) // and their start frames - pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); - DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); + pDoc->CalculatePagesForPrinting( *m_pPrintUIOptions, bIsPDFExport, nPageCount ); - // get vector of pages to print according to PageRange and valid pages from above - // (result may be an empty vector, for example if the range string is not correct) - StringRangeEnumerator::getRangesFromString( - aPageRange, m_pPrintUIOptions->GetPagesToPrint(), - 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + if (nPostItMode != POSTITS_NONE) + { + pDoc->UpdatePagesForPrintingWithPostItData( + *m_pPrintUIOptions, bIsPDFExport, nPageCount ); + } nRet = m_pPrintUIOptions->GetPagesToPrint().size(); } @@ -2862,16 +2864,8 @@ void SAL_CALL SwXTextDocument::render( ((SwPagePreView*)pView)->GetViewShell(); } - uno::Any aAny( m_pPrintUIOptions->getValue( C2U( "RenderDevice" ) )); - uno::Reference< awt::XDevice > xRenderDevice; - aAny >>= xRenderDevice; - - OutputDevice* pOut = 0; - if (xRenderDevice.is()) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - pOut = pDevice ? pDevice->GetOutputDevice() : 0; - } + // get output device to use + OutputDevice* pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); if(pVwSh && pOut) { @@ -2974,6 +2968,9 @@ void SAL_CALL SwXTextDocument::render( if (bLastPage) { + if (m_pPrintUIOptions->HasPostItData()) + m_pPrintUIOptions->DeletePostItData(); + if (m_pHiddenViewFrame) { lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); -- cgit v1.2.3 From 3d9480a5cb3ba8fb8af49731e86b2eb9d69f980c Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 21 Aug 2009 06:44:00 +0000 Subject: #i101242# new print UI in sw --- sw/source/core/doc/doc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2abd783cc9f6..78e0f2cedb3a 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1414,7 +1414,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now //TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); - bool bPrintProspect_RTL = rOptions.getIntValue( "PrintBrochureRTL", 0 ) ? true : false; + bool bPrintProspect_RTL = rOptions.getIntValue( "PrintProspectRTL", 0 ) ? true : false; // get pages for prospect printing according to the 'PageRange' // (duplicates and any order allowed!) -- cgit v1.2.3 From 88f90d83a9a285e7739e29ecaf28f1937e3abcbf Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 21 Aug 2009 11:30:53 +0000 Subject: #i101242# new print UI in sw --- sw/inc/printdata.hxx | 2 +- sw/source/core/doc/doc.cxx | 83 +++++++++++++++++++++++++++++++++++++----- sw/source/core/view/vprint.cxx | 12 +++--- 3 files changed, 81 insertions(+), 16 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index ed463a6cb28c..d9be041ded8c 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -75,7 +75,7 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper public: // PostIt relevant data - _SetGetExpFlds * m_pPostItFields; + _SetGetExpFlds * m_pPostItFields; // an array of "_SetGetExpFld *" sorted by page and line numbers SwDoc * m_pPostItDoc; ViewShell * m_pPostItShell; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 78e0f2cedb3a..9791de575914 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -114,6 +114,7 @@ #include #include +#include #include #include @@ -1086,13 +1087,23 @@ static void lcl_FormatPostIt( IDocumentContentOperations* pIDCO, SwPaM& aPam, SwPostItField* pField, + bool bNewPage, bool bIsFirstPostIt, USHORT nPageNo, USHORT nLineNo ) { static char __READONLY_DATA sTmp[] = " : "; DBG_ASSERT( ViewShell::GetShellRes(), "missing ShellRes" ); - String aStr( ViewShell::GetShellRes()->aPostItPage ); + if (bNewPage) + pIDCO->Insert( aPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0 ); + else if (!bIsFirstPostIt) + { + // add an empty line between different notes + pIDCO->SplitNode( *aPam.GetPoint(), false ); + pIDCO->SplitNode( *aPam.GetPoint(), false ); + } + + String aStr( ViewShell::GetShellRes()->aPostItPage ); aStr.AppendAscii(sTmp); aStr += XubString::CreateFromInt32( nPageNo ); @@ -1118,8 +1129,6 @@ static void lcl_FormatPostIt( aStr.EraseAllChars( '\r' ); #endif pIDCO->Insert( aPam, aStr, true ); - pIDCO->SplitNode( *aPam.GetPoint(), false ); - pIDCO->SplitNode( *aPam.GetPoint(), false ); } @@ -1313,26 +1322,56 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( const StringRangeEnumerator aRangeEnum( rOptions.GetPageRange(), 1, nDocPageCount, 0 ); - USHORT nVirtPg = 0, nLineNo = 0; + // For mode POSTITS_ENDPAGE: + // maps a physical page number to the page number in post-it document that holds + // the first post-it for that physical page . Needed to relate the correct start frames + // from the post-it doc to the physical page of the document + std::map< sal_Int32, sal_Int32 > aPostItStartPageNum; + + // add all post-its on valid pages within the the page range to the + // temporary post-it document. + // Since the array of post-it fileds is sorted by page and line number we will + // already get them in the correct order + USHORT nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0; + bool bIsFirstPostIt = true; for (USHORT i = 0; i < nPostItCount; ++i) { _PostItFld& rPostIt = (_PostItFld&)*(*rOptions.m_pPostItFields)[ i ]; - const USHORT nPhyPageNum = rPostIt.GetPageNo( + nLastPageNum = nPhyPageNum; + nPhyPageNum = rPostIt.GetPageNo( aRangeEnum, rOptions.GetValidPagesSet(), true /*TLPDF bRgt*/, true /*TLPDF bLft*/, nVirtPg, nLineNo ); if (nPhyPageNum) + { + // need to insert a page break? + // In POSTITS_ENDPAGE mode for each document page the following + // post-it page needs to start on a new page + const bool bNewPage = nPostItMode == POSTITS_ENDPAGE && + !bIsFirstPostIt && nPhyPageNum != nLastPageNum; + lcl_FormatPostIt( rOptions.m_pPostItShell->GetDoc(), aPam, - rPostIt.GetPostIt(), nVirtPg, nLineNo ); + rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo ); + bIsFirstPostIt = false; + + if (nPostItMode == POSTITS_ENDPAGE) + { + // get the correct number of current pages for the post-it document + rOptions.m_pPostItShell->CalcLayout(); + const sal_Int32 nPages = rOptions.m_pPostItDoc->GetPageCount(); + aPostItStartPageNum[ nPhyPageNum ] = nPages; + } + } } // format post-it doc to get correct number of pages rOptions.m_pPostItShell->CalcLayout(); const sal_Int32 nPostItDocPageCount = rOptions.m_pPostItDoc->GetPageCount(); - // now add those post-it pages to the vector of pages to print - // or replace them if only post-its should be printed if (nPostItMode == POSTITS_ONLY || nPostItMode == POSTITS_ENDDOC) { + // now add those post-it pages to the vector of pages to print + // or replace them if only post-its should be printed + rOptions.GetPostItStartFrame().clear(); if (nPostItMode == POSTITS_ENDDOC) { @@ -1351,7 +1390,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // of the vector of pages to print and keep the GetPostItStartFrame // data conform with it sal_Int32 nPageNum = 0; - const SwPageFrm *pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); + const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); while( pPageFrm && nPageNum < nPostItDocPageCount ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); @@ -1362,6 +1401,32 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( } DBG_ASSERT( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); } + else if (nPostItMode == POSTITS_ENDPAGE) + { + // the next step is to find all the start frames from the post-it + // document that should be printed for a given physical page of the document + std::map< sal_Int32, std::vector< const SwPageFrm * > > aPhysPageToPostItFrames; + + // collect all post-it doc start frames in a vector + std::vector< const SwPageFrm * > aAllPostItStartFrames; + const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); + while( pPageFrm && aAllPostItStartFrames.size() < nPostItDocPageCount ) + { + DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); + pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); + aAllPostItStartFrames.push_back( pPageFrm ); + } + DBG_ASSERT( aAllPostItStartFrames.size() == nPostItDocPageCount, + "unexpected number of frames; does not match number of pages" ); + + std::map< sal_Int32, sal_Int32 >::const_iterator aIt; + for (aIt = aPostItStartPageNum.begin(); aIt != aPostItStartPageNum.end(); ++aIt) + { + const sal_Int32 nStartPageNum = aIt->second; + std::vector< const SwPageFrm * > aStartFrames; + aPhysPageToPostItFrames[ aIt->first ] = aStartFrames; + } + } } } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 8e647db8fff7..168da78f51ed 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -528,9 +528,9 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) { - m_pPostItFields = new _SetGetExpFlds; + m_pPostItFields = new _SetGetExpFlds; lcl_GetPostIts( pDoc, *m_pPostItFields ); - m_pPostItDoc = new SwDoc; + m_pPostItDoc = new SwDoc; //!! Disable spell and grammar checking in the temporary document. //!! Otherwise the grammar checker might process it and crash if we later on @@ -538,7 +538,7 @@ void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewO SwViewOption aViewOpt( *pViewOpt ); aViewOpt.SetOnlineSpell( FALSE ); - m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); } @@ -549,9 +549,9 @@ void SwPrintUIOptions::DeletePostItData() m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. delete m_pPostItFields; - m_pPostItDoc = 0; - m_pPostItShell = 0; - m_pPostItFields = 0; + m_pPostItDoc = 0; + m_pPostItShell = 0; + m_pPostItFields = 0; } } -- cgit v1.2.3 From 5eb7986ababc2f9f45417bd28ad2af78f29e8828 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 21 Aug 2009 13:32:05 +0000 Subject: #i92516# notes changes --- sw/source/core/doc/doc.cxx | 57 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 9791de575914..0f471c3c82f3 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1095,7 +1095,10 @@ static void lcl_FormatPostIt( DBG_ASSERT( ViewShell::GetShellRes(), "missing ShellRes" ); if (bNewPage) - pIDCO->Insert( aPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0 ); + { + pIDCO->Insert( aPam, SvxFmtBreakItem( SVX_BREAK_PAGE_AFTER, RES_BREAK ), 0 ); + pIDCO->SplitNode( *aPam.GetPoint(), false ); + } else if (!bIsFirstPostIt) { // add an empty line between different notes @@ -1407,25 +1410,71 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // document that should be printed for a given physical page of the document std::map< sal_Int32, std::vector< const SwPageFrm * > > aPhysPageToPostItFrames; - // collect all post-it doc start frames in a vector + // ... thus, first collect all post-it doc start frames in a vector std::vector< const SwPageFrm * > aAllPostItStartFrames; const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); while( pPageFrm && aAllPostItStartFrames.size() < nPostItDocPageCount ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); - pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); aAllPostItStartFrames.push_back( pPageFrm ); + pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); } DBG_ASSERT( aAllPostItStartFrames.size() == nPostItDocPageCount, "unexpected number of frames; does not match number of pages" ); + // get a map that holds all post-it frames to be printed for a + // given physical page from the document std::map< sal_Int32, sal_Int32 >::const_iterator aIt; for (aIt = aPostItStartPageNum.begin(); aIt != aPostItStartPageNum.end(); ++aIt) { const sal_Int32 nStartPageNum = aIt->second; + DBG_ASSERT( 1 <= nStartPageNum && nStartPageNum <= nPostItDocPageCount, + "page number for first frame out of range" ); + const sal_Int32 nFrames = 1; // TLPDF2DO: get the correct number of frames std::vector< const SwPageFrm * > aStartFrames; - aPhysPageToPostItFrames[ aIt->first ] = aStartFrames; + for (sal_Int32 i = 0; i < nFrames; ++i) + { + const sal_Int32 nIdx = nStartPageNum - 1 + i; // -1 because lowest page num is 1 + DBG_ASSERT( 0 <= nIdx && nIdx < aAllPostItStartFrames.size(), + "index out of range" ); + aStartFrames.push_back( aAllPostItStartFrames[ nIdx ] ); + } + aPhysPageToPostItFrames[ aIt->first /* phys page num */ ] = aStartFrames; } + + + // ok, now that aPhysPageToPostItFrames can give the start frames for all + // post-it pages to be printed we need to merge those at the correct + // position into the GetPagesToPrint vector and build and maintain the + // GetPostItStartFrame vector as well. + // Since inserting a larger number of entries in the middle of a vector + // isn't that efficient we will create new vectors by copying the required data + std::vector< sal_Int32 > aTmpPagesToPrint; + std::vector< const SwPageFrm * > aTmpPostItStartFrames; + const size_t nNum = rOptions.GetPagesToPrint().size(); + for (size_t i = 0 ; i < nNum; ++i) + { + // add the physical page to print from the document + const sal_Int32 nPhysPage = rOptions.GetPagesToPrint()[i]; + aTmpPagesToPrint.push_back( nPhysPage ); + aTmpPostItStartFrames.push_back( NULL ); + + // add the post-it document pages to print, i.e those + // post-it pages that have the data for the above physical page + const std::vector< const SwPageFrm * > &rPostItFrames = aPhysPageToPostItFrames[ nPhysPage ]; + const size_t nPostItFrames = rPostItFrames.size(); + for (size_t k = 0; k < nPostItFrames; ++k) + { + aTmpPagesToPrint.push_back( 0 ); + aTmpPostItStartFrames.push_back( rPostItFrames[k] ); + } + } + + // finally we need to assign those vectors to the resulting ones. + // swapping the data should be more efficient than assigning since + // we won't need the temporary vectors anymore + rOptions.GetPagesToPrint().swap( aTmpPagesToPrint ); + rOptions.GetPostItStartFrame().swap( aTmpPostItStartFrames ); } } } -- cgit v1.2.3 From ff0c53640ac0a74134b625791fb48b29d90f4fcb Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 21 Aug 2009 15:30:14 +0000 Subject: resolve conflicts --- sw/inc/unotxdoc.hxx | 30 +++++++++++++++++------------- sw/source/ui/uno/unotxdoc.cxx | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 216516d0d879..67270d15d392 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -69,9 +69,8 @@ #include #include #include -#ifndef _COM_SUN_STAR_DOCUMENT_XDOCUMENTLANGUAGES_HPP #include -#endif +#include #include #include #include @@ -80,22 +79,22 @@ #include // helper for implementations #include -#define __IFC31 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \ -Ifc17, Ifc18, Ifc19, Ifc20, Ifc21, Ifc22, Ifc23, Ifc24, Ifc25, Ifc26, Ifc27, Ifc28, Ifc29, Ifc30, Ifc31 +#define __IFC32 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \ +Ifc17, Ifc18, Ifc19, Ifc20, Ifc21, Ifc22, Ifc23, Ifc24, Ifc25, Ifc26, Ifc27, Ifc28, Ifc29, Ifc30, Ifc31, Ifc32 -#define __CLASS_IFC31 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, \ +#define __CLASS_IFC32 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, \ class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13, class Ifc14, class Ifc15, class Ifc16, \ class Ifc17, class Ifc18, class Ifc19, class Ifc20, class Ifc21, class Ifc22, class Ifc23, class Ifc24,\ -class Ifc25, class Ifc26, class Ifc27, class Ifc28, class Ifc29, class Ifc30, class Ifc31 +class Ifc25, class Ifc26, class Ifc27, class Ifc28, class Ifc29, class Ifc30, class Ifc31 , class Ifc32 -#define __PUBLIC_IFC31 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, \ +#define __PUBLIC_IFC32 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, \ public Ifc13, public Ifc14, public Ifc15, public Ifc16, public Ifc17, public Ifc18, \ public Ifc19, public Ifc20, public Ifc21, public Ifc22, public Ifc23, public Ifc24, \ public Ifc25, public Ifc26, public Ifc27, public Ifc28, public Ifc29, public Ifc30, \ -public Ifc31 +public Ifc31, public Ifc32 #include #include -#define __IFC_EX_TYPE_INIT31( class_cast ) \ +#define __IFC_EX_TYPE_INIT32( class_cast ) \ __IFC_EX_TYPE_INIT( class_cast, 1 ), __IFC_EX_TYPE_INIT( class_cast, 2 ), \ __IFC_EX_TYPE_INIT( class_cast, 3 ), __IFC_EX_TYPE_INIT( class_cast, 4 ), \ __IFC_EX_TYPE_INIT( class_cast, 5 ), __IFC_EX_TYPE_INIT( class_cast, 6 ), \ @@ -111,12 +110,12 @@ public Ifc31 __IFC_EX_TYPE_INIT( class_cast, 25 ), __IFC_EX_TYPE_INIT( class_cast, 26 ), \ __IFC_EX_TYPE_INIT( class_cast, 27 ), __IFC_EX_TYPE_INIT( class_cast, 28 ), \ __IFC_EX_TYPE_INIT( class_cast, 29 ), __IFC_EX_TYPE_INIT( class_cast, 30 ), \ - __IFC_EX_TYPE_INIT( class_cast, 31) + __IFC_EX_TYPE_INIT( class_cast, 31 ), __IFC_EX_TYPE_INIT( class_cast, 32) #include -__DEF_IMPLHELPER_EX( 31 ) +__DEF_IMPLHELPER_EX( 32 ) -namespace css = ::com::sun::star; +namespace css = ::com::sun::star; class SwDoc; class SwDocShell; @@ -137,7 +136,7 @@ SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) ******************************************************************************/ -typedef cppu::WeakImplHelper31 +typedef cppu::WeakImplHelper32 < css::text::XTextDocument, css::text::XLineNumberingProperties, @@ -170,6 +169,7 @@ typedef cppu::WeakImplHelper31 css::xforms::XFormsSupplier, css::text::XFlatParagraphIteratorProvider, css::document::XDocumentLanguages + css::util::XCloneable > SwXTextDocumentBaseClass; @@ -409,6 +409,10 @@ public: // css::text::XFlatParagraphIteratorProvider: virtual css::uno::Reference< css::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) throw (css::uno::RuntimeException); + // ::com::sun::star::util::XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); + + // void Invalidate(); void Reactivate(SwDocShell* pNewDocShell); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index f93d3c9400ef..83d03bbbea8f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -3002,7 +3002,27 @@ uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlat { return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic ); } +/*-- 07.05.2009 09:21:12--------------------------------------------------- + -----------------------------------------------------------------------*/ +uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno::RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + if(!IsValid()) + throw RuntimeException(); + //create a new document - hidden - copy the storage and return it + SwDoc* pCopyDoc = pDocShell->GetDoc()->CreateCopy(); + SfxObjectShell* pShell = new SwDocShell( pCopyDoc, SFX_CREATE_MODE_STANDARD ); + pShell->DoInitNew(); + + uno::Reference< embed::XStorage > xSourceStorage = getDocumentStorage(); + uno::Reference< frame::XModel > xNewModel = pShell->GetModel(); + //copy this storage + uno::Reference< document::XStorageBasedDocument > xStorageDoc( xNewModel, uno::UNO_QUERY ); + uno::Reference< embed::XStorage > xNewStorage = xStorageDoc->getDocumentStorage(); + xSourceStorage->copyToStorage( xNewStorage ); + return uno::Reference< util::XCloneable >( xNewModel, UNO_QUERY ); +} /* -----------------------------20.06.00 09:54-------------------------------- ---------------------------------------------------------------------------*/ -- cgit v1.2.3 From 1fc2beb42390e44b04d933db3df5c0db792350e8 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 22 Aug 2009 08:55:14 +0000 Subject: #i92516# make compile --- sw/source/core/doc/doc.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 572fbeb5cc7f..e09fc5a84888 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -110,7 +110,7 @@ #include // _SetGetExpFld #include // SwPostItField #include -#include +#include #include #include @@ -1304,7 +1304,7 @@ void SwDoc::CalculatePagesForPrinting( void SwDoc::UpdatePagesForPrintingWithPostItData( /* out */ SwPrintUIOptions &rOptions, - bool bIsPDFExport, + bool /*bIsPDFExport*/, sal_Int32 nDocPageCount ) { @@ -1413,7 +1413,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // ... thus, first collect all post-it doc start frames in a vector std::vector< const SwPageFrm * > aAllPostItStartFrames; const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); - while( pPageFrm && aAllPostItStartFrames.size() < nPostItDocPageCount ) + while( pPageFrm && aAllPostItStartFrames.size() < size_t(nPostItDocPageCount) ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); aAllPostItStartFrames.push_back( pPageFrm ); -- cgit v1.2.3 From d428cc7df23f37115463419ead90af99395a7456 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 22 Aug 2009 09:03:24 +0000 Subject: make compile --- sw/source/core/doc/doc.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index e09fc5a84888..703cb740e99a 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1419,7 +1419,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( aAllPostItStartFrames.push_back( pPageFrm ); pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); } - DBG_ASSERT( aAllPostItStartFrames.size() == nPostItDocPageCount, + DBG_ASSERT( aAllPostItStartFrames.size() == size_t(nPostItDocPageCount), "unexpected number of frames; does not match number of pages" ); // get a map that holds all post-it frames to be printed for a @@ -1435,7 +1435,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( for (sal_Int32 i = 0; i < nFrames; ++i) { const sal_Int32 nIdx = nStartPageNum - 1 + i; // -1 because lowest page num is 1 - DBG_ASSERT( 0 <= nIdx && nIdx < aAllPostItStartFrames.size(), + DBG_ASSERT( 0 <= nIdx && size_t(nIdx) < aAllPostItStartFrames.size(), "index out of range" ); aStartFrames.push_back( aAllPostItStartFrames[ nIdx ] ); } -- cgit v1.2.3 From 8e24d60a844f03e6ff664a5c5ceddfbd95cd75d7 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Sat, 22 Aug 2009 10:11:49 +0000 Subject: make compile --- sw/inc/unotxdoc.hxx | 2 +- sw/source/core/view/vprint.cxx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 67270d15d392..19b32df6c255 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -168,7 +168,7 @@ typedef cppu::WeakImplHelper32 css::view::XRenderable, css::xforms::XFormsSupplier, css::text::XFlatParagraphIteratorProvider, - css::document::XDocumentLanguages + css::document::XDocumentLanguages, css::util::XCloneable > SwXTextDocumentBaseClass; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index b2f33dd5a152..1e60f6783b56 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -529,8 +529,8 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) { m_pPostItFields = new _SetGetExpFlds; - lcl_GetPostIts( pDoc, *m_pPostItFields ); - m_pPostItDoc = new SwDoc; + lcl_GetPostIts( pDoc, *m_pPostItFields ); + m_pPostItDoc = new SwDoc; //!! Disable spell and grammar checking in the temporary document. //!! Otherwise the grammar checker might process it and crash if we later on @@ -538,7 +538,7 @@ void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewO SwViewOption aViewOpt( *pViewOpt ); aViewOpt.SetOnlineSpell( FALSE ); - m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); } @@ -1200,7 +1200,7 @@ sal_Bool ViewShell::PrintOrPDFExport( if( /*!pShell->Imp()->IsStopOutDev() && */ ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { - BOOL bStop = FALSE; +// TLPDF BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; XubString sJobName( rPrintData.GetJobName() ); @@ -1230,8 +1230,8 @@ sal_Bool ViewShell::PrintOrPDFExport( // PostitListe holen _SetGetExpFlds aPostItFields; - SwDoc* pPostItDoc = 0; - ViewShell* pPostItShell = 0; +// TLPDF SwDoc* pPostItDoc = 0; +// TLPDF ViewShell* pPostItShell = 0; #ifdef TL_NOT_NOW /*TLPDF*/ if( rPrintData.nPrintPostIts != POSTITS_NONE ) { -- cgit v1.2.3 From f8775840347067a54bd90c906b31e5fb258293d6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 25 Aug 2009 13:10:30 +0000 Subject: #i101242# changes for printing of notes --- sw/inc/printdata.hxx | 18 ++++++------- sw/source/core/doc/doc.cxx | 58 ++++++++++++++++++++++-------------------- sw/source/core/view/viewpg.cxx | 2 +- sw/source/core/view/vprint.cxx | 22 ++++++++-------- 4 files changed, 53 insertions(+), 47 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index d9be041ded8c..e00ef66c977d 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -57,14 +57,14 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper // pages valid for printing (according to the current settings) // and their respective start frames (see getRendererCount in unotxdoc.cxx) // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! - std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) - std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrms; // the map of start frames for those pages + std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) + std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrames; // the map of start frames for those pages // vector of pages and their order to be printed (duplicates and any order allowed!) // (see 'render' in unotxdoc.cxx) - std::vector< sal_Int32 > m_aPagesToPrint; + std::vector< sal_Int32 > m_aPagesToPrint; - std::vector< const SwPageFrm * > m_aPostItStartFrame; + std::vector< const SwPageFrm * > m_aPostItStartFrames; // for prospect printing: the pairs of pages to be printed together on a single prospect page. // -1 indicates a half page to be left empty. @@ -102,8 +102,8 @@ public: std::set< sal_Int32 > & GetValidPagesSet() { return m_aValidPages; } const std::set< sal_Int32 > & GetValidPagesSet() const { return m_aValidPages; } - ValidStartFramesMap_t & GetValidStartFrms() { return m_aValidStartFrms; } - const ValidStartFramesMap_t & GetValidStartFrms() const { return m_aValidStartFrms; } + ValidStartFramesMap_t & GetValidStartFrames() { return m_aValidStartFrames; } + const ValidStartFramesMap_t & GetValidStartFrames() const { return m_aValidStartFrames; } // used for 'normal' printing // A page value of 0 as entry indicates that this page is not from the document but @@ -112,14 +112,14 @@ public: const std::vector< sal_Int32 > & GetPagesToPrint() const { return m_aPagesToPrint; } // used for 'normal' printing with post-its - // - if the vector entry will be NULL then the respective page to be printed is from + // - if the map entry will be NULL then the respective page to be printed is from // the document. In that case use the value from GetPagesToPrint at the same index to // get the phys. page number to be printed, and then retrieve the start frame to use // from GetValidStartFrms. // - If the entry is not NULL it is the start frame of the page from the post-it document // that is to be printed - std::vector< const SwPageFrm * > & GetPostItStartFrame() { return m_aPostItStartFrame; } - const std::vector< const SwPageFrm * > & GetPostItStartFrame() const { return m_aPostItStartFrame; } + std::vector< const SwPageFrm * > & GetPostItStartFrames() { return m_aPostItStartFrames; } + const std::vector< const SwPageFrm * > & GetPostItStartFrames() const { return m_aPostItStartFrames; } // used for prospect printing only PagePairsVec_t & GetPagePairsForProspectPrinting() { return m_aPagePairs; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 703cb740e99a..2f10f585cf15 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -110,7 +110,7 @@ #include // _SetGetExpFld #include // SwPostItField #include -#include +#include #include #include @@ -1223,7 +1223,7 @@ void SwDoc::CalculatePagesForPrinting( nPageNo = nFirstPageNo; std::set< sal_Int32 > &rValidPages = rOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrms(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrames(); rValidPages.clear(); rValidStartFrms.clear(); while ( pStPage ) @@ -1304,7 +1304,7 @@ void SwDoc::CalculatePagesForPrinting( void SwDoc::UpdatePagesForPrintingWithPostItData( /* out */ SwPrintUIOptions &rOptions, - bool /*bIsPDFExport*/, + bool bIsPDFExport, sal_Int32 nDocPageCount ) { @@ -1329,7 +1329,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // maps a physical page number to the page number in post-it document that holds // the first post-it for that physical page . Needed to relate the correct start frames // from the post-it doc to the physical page of the document - std::map< sal_Int32, sal_Int32 > aPostItStartPageNum; + std::map< sal_Int32, sal_Int32 > aPostItLastStartPageNum; // add all post-its on valid pages within the the page range to the // temporary post-it document. @@ -1361,7 +1361,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // get the correct number of current pages for the post-it document rOptions.m_pPostItShell->CalcLayout(); const sal_Int32 nPages = rOptions.m_pPostItDoc->GetPageCount(); - aPostItStartPageNum[ nPhyPageNum ] = nPages; + aPostItLastStartPageNum[ nPhyPageNum ] = nPages; } } } @@ -1375,13 +1375,13 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // now add those post-it pages to the vector of pages to print // or replace them if only post-its should be printed - rOptions.GetPostItStartFrame().clear(); + rOptions.GetPostItStartFrames().clear(); if (nPostItMode == POSTITS_ENDDOC) { // set all values up to number of pages to print currently known to NULL, // meaning none of the pages currently in the vector is from the // post-it document, they are the documents pages. - rOptions.GetPostItStartFrame().resize( rOptions.GetPagesToPrint().size() ); + rOptions.GetPostItStartFrames().resize( rOptions.GetPagesToPrint().size() ); } else if (nPostItMode == POSTITS_ONLY) { @@ -1390,7 +1390,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( } // now we just need to add the post-it pages to be printed to the end - // of the vector of pages to print and keep the GetPostItStartFrame + // of the vector of pages to print and keep the GetValidStartFrames // data conform with it sal_Int32 nPageNum = 0; const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); @@ -1399,7 +1399,8 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); ++nPageNum; rOptions.GetPagesToPrint().push_back( 0 ); // a page number of 0 indicates this page is from the post-it doc - rOptions.GetPostItStartFrame().push_back( pPageFrm ); + DBG_ASSERT( pPageFrm, "pPageFrm is NULL!" ); + rOptions.GetPostItStartFrames().push_back( pPageFrm ); pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); } DBG_ASSERT( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); @@ -1411,42 +1412,47 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( std::map< sal_Int32, std::vector< const SwPageFrm * > > aPhysPageToPostItFrames; // ... thus, first collect all post-it doc start frames in a vector + sal_Int32 nPostItPageNum = 0; std::vector< const SwPageFrm * > aAllPostItStartFrames; const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); - while( pPageFrm && aAllPostItStartFrames.size() < size_t(nPostItDocPageCount) ) + while( pPageFrm && aAllPostItStartFrames.size() < nPostItDocPageCount ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); + ++nPostItPageNum; aAllPostItStartFrames.push_back( pPageFrm ); pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); } - DBG_ASSERT( aAllPostItStartFrames.size() == size_t(nPostItDocPageCount), + DBG_ASSERT( aAllPostItStartFrames.size() == nPostItDocPageCount, "unexpected number of frames; does not match number of pages" ); // get a map that holds all post-it frames to be printed for a // given physical page from the document + sal_Int32 nLastStartPageNum = 0; std::map< sal_Int32, sal_Int32 >::const_iterator aIt; - for (aIt = aPostItStartPageNum.begin(); aIt != aPostItStartPageNum.end(); ++aIt) + for (aIt = aPostItLastStartPageNum.begin(); aIt != aPostItLastStartPageNum.end(); ++aIt) { - const sal_Int32 nStartPageNum = aIt->second; - DBG_ASSERT( 1 <= nStartPageNum && nStartPageNum <= nPostItDocPageCount, + const sal_Int32 nFrames = aIt->second - nLastStartPageNum; + const sal_Int32 nFirstStartPageNum = aIt == aPostItLastStartPageNum.begin() ? + 1 : aIt->second - nFrames + 1; + DBG_ASSERT( 1 <= nFirstStartPageNum && nFirstStartPageNum <= nPostItDocPageCount, "page number for first frame out of range" ); - const sal_Int32 nFrames = 1; // TLPDF2DO: get the correct number of frames std::vector< const SwPageFrm * > aStartFrames; for (sal_Int32 i = 0; i < nFrames; ++i) { - const sal_Int32 nIdx = nStartPageNum - 1 + i; // -1 because lowest page num is 1 - DBG_ASSERT( 0 <= nIdx && size_t(nIdx) < aAllPostItStartFrames.size(), + const sal_Int32 nIdx = nFirstStartPageNum - 1 + i; // -1 because lowest page num is 1 + DBG_ASSERT( 0 <= nIdx && nIdx < aAllPostItStartFrames.size(), "index out of range" ); aStartFrames.push_back( aAllPostItStartFrames[ nIdx ] ); } aPhysPageToPostItFrames[ aIt->first /* phys page num */ ] = aStartFrames; + nLastStartPageNum = aIt->second; } // ok, now that aPhysPageToPostItFrames can give the start frames for all // post-it pages to be printed we need to merge those at the correct // position into the GetPagesToPrint vector and build and maintain the - // GetPostItStartFrame vector as well. + // GetValidStartFrames vector as well. // Since inserting a larger number of entries in the middle of a vector // isn't that efficient we will create new vectors by copying the required data std::vector< sal_Int32 > aTmpPagesToPrint; @@ -1474,7 +1480,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // swapping the data should be more efficient than assigning since // we won't need the temporary vectors anymore rOptions.GetPagesToPrint().swap( aTmpPagesToPrint ); - rOptions.GetPostItStartFrame().swap( aTmpPostItStartFrames ); + rOptions.GetPostItStartFrames().swap( aTmpPostItStartFrames ); } } } @@ -1485,7 +1491,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( sal_Int32 nDocPageCount ) { std::set< sal_Int32 > &rValidPagesSet = rOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrms(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrames(); std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rOptions.GetPagePairsForProspectPrinting(); rPagePairs.clear(); @@ -2367,13 +2373,11 @@ BOOL SwDoc::ConvertFieldsToText() sText.Erase(); //now remove the field and insert the string - SwPaM aPam1(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart()); - aPam1.Move(); - Insert( aPam1, sText, true );//insert first to keep the field's attributes - SwPaM aPam2(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart()); - aPam2.SetMark(); - aPam2.Move(); - DeleteAndJoin(aPam2);//remove the field + SwPaM aPam(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart()); + aPam.SetMark(); + aPam.Move(); + DeleteAndJoin(aPam); + Insert( aPam, sText, true ); } } ++aBegin; diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 353e4483fd12..79dbdfc1f962 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -703,7 +703,7 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ const SwPageFrm *pStPage = 0; const SwPageFrm *pNxtPage = 0; - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrames(); if (rPagesToPrint.first > 0) { SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 1e60f6783b56..e5250d192b80 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -529,8 +529,8 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) { m_pPostItFields = new _SetGetExpFlds; - lcl_GetPostIts( pDoc, *m_pPostItFields ); - m_pPostItDoc = new SwDoc; + lcl_GetPostIts( pDoc, *m_pPostItFields ); + m_pPostItDoc = new SwDoc; //!! Disable spell and grammar checking in the temporary document. //!! Otherwise the grammar checker might process it and crash if we later on @@ -538,7 +538,7 @@ void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewO SwViewOption aViewOpt( *pViewOpt ); aViewOpt.SetOnlineSpell( FALSE ); - m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); } @@ -823,7 +823,7 @@ SwDoc * ViewShell::CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef &rDocShell // Wir bauen uns ein neues Dokument SwDoc *pPrtDoc = new SwDoc; pPrtDoc->acquire(); - pPrtDoc->SetRefForDocShell( boost::addressof(rDocShellRef) ); + pPrtDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)rDocShellRef ); pPrtDoc->LockExpFlds(); /* TLPDF @@ -913,7 +913,7 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) // Wir bauen uns ein neues Dokument // SwDoc *pPrtDoc = new SwDoc; // pPrtDoc->acquire(); -// pPrtDoc->SetRefForDocShell( boost::addressof(rDocShellRef) ); +// pPrtDoc->SetRefForDocShell( (SvEmbeddedObjectRef*)&(long&)rDocShellRef ); pPrtDoc->LockExpFlds(); // Der Drucker wird uebernommen @@ -1167,15 +1167,17 @@ sal_Bool ViewShell::PrintOrPDFExport( const SwPageFrm *pStPage = 0; if (nPage > 0) // a 'regular' page, not one from the post-it document { - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrames(); SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + if (aIt == rFrms.end()) + return sal_False; pStPage = aIt->second; } else // a page from the post-its document ... { DBG_ASSERT( nPage == 0, "unexpected page number. 0 for post-it pages expected" ); - pStPage = rPrintData.GetPrintUIOptions().GetPostItStartFrame()[ nRenderer ]; + pStPage = rPrintData.GetPrintUIOptions().GetPostItStartFrames()[ nRenderer ]; } DBG_ASSERT( pStPage, "failed to get start page" ); /* TLPDF neu: end */ @@ -1200,7 +1202,7 @@ sal_Bool ViewShell::PrintOrPDFExport( if( /*!pShell->Imp()->IsStopOutDev() && */ ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { -// TLPDF BOOL bStop = FALSE; + BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; XubString sJobName( rPrintData.GetJobName() ); @@ -1230,8 +1232,8 @@ sal_Bool ViewShell::PrintOrPDFExport( // PostitListe holen _SetGetExpFlds aPostItFields; -// TLPDF SwDoc* pPostItDoc = 0; -// TLPDF ViewShell* pPostItShell = 0; + SwDoc* pPostItDoc = 0; + ViewShell* pPostItShell = 0; #ifdef TL_NOT_NOW /*TLPDF*/ if( rPrintData.nPrintPostIts != POSTITS_NONE ) { -- cgit v1.2.3 From b457c6a75b61c58bcf72ebdf2282a164c09803d6 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 26 Aug 2009 17:36:02 +0000 Subject: remove warnings --- sw/source/core/doc/doc.cxx | 10 +++++----- sw/source/core/view/vprint.cxx | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2f10f585cf15..9a730106ea80 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -110,7 +110,7 @@ #include // _SetGetExpFld #include // SwPostItField #include -#include +#include #include #include @@ -1304,7 +1304,7 @@ void SwDoc::CalculatePagesForPrinting( void SwDoc::UpdatePagesForPrintingWithPostItData( /* out */ SwPrintUIOptions &rOptions, - bool bIsPDFExport, + bool /*bIsPDFExport*/, sal_Int32 nDocPageCount ) { @@ -1415,14 +1415,14 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( sal_Int32 nPostItPageNum = 0; std::vector< const SwPageFrm * > aAllPostItStartFrames; const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); - while( pPageFrm && aAllPostItStartFrames.size() < nPostItDocPageCount ) + while( pPageFrm && sal_Int32(aAllPostItStartFrames.size()) < nPostItDocPageCount ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); ++nPostItPageNum; aAllPostItStartFrames.push_back( pPageFrm ); pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); } - DBG_ASSERT( aAllPostItStartFrames.size() == nPostItDocPageCount, + DBG_ASSERT( sal_Int32(aAllPostItStartFrames.size()) == nPostItDocPageCount, "unexpected number of frames; does not match number of pages" ); // get a map that holds all post-it frames to be printed for a @@ -1440,7 +1440,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( for (sal_Int32 i = 0; i < nFrames; ++i) { const sal_Int32 nIdx = nFirstStartPageNum - 1 + i; // -1 because lowest page num is 1 - DBG_ASSERT( 0 <= nIdx && nIdx < aAllPostItStartFrames.size(), + DBG_ASSERT( 0 <= nIdx && nIdx < sal_Int32(aAllPostItStartFrames.size()), "index out of range" ); aStartFrames.push_back( aAllPostItStartFrames[ nIdx ] ); } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index e5250d192b80..98c58a66121a 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1202,7 +1202,7 @@ sal_Bool ViewShell::PrintOrPDFExport( if( /*!pShell->Imp()->IsStopOutDev() && */ ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { - BOOL bStop = FALSE; +// TLPDF BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; XubString sJobName( rPrintData.GetJobName() ); @@ -1232,8 +1232,8 @@ sal_Bool ViewShell::PrintOrPDFExport( // PostitListe holen _SetGetExpFlds aPostItFields; - SwDoc* pPostItDoc = 0; - ViewShell* pPostItShell = 0; +// TLPDF SwDoc* pPostItDoc = 0; +// TLPDF ViewShell* pPostItShell = 0; #ifdef TL_NOT_NOW /*TLPDF*/ if( rPrintData.nPrintPostIts != POSTITS_NONE ) { -- cgit v1.2.3 From 9420cb434f1c878d780f8f0c736d1df1339fa265 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 27 Aug 2009 10:11:34 +0000 Subject: #101242# getRenderer fixed (adding of additional proerties; e.g. PageSize --- sw/source/ui/uno/unotxdoc.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 83d03bbbea8f..3b774180dd63 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2750,11 +2750,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False )) aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); uno::Sequence< beans::PropertyValue > aRenderer(2); - PropertyValue &rValue = aRenderer.getArray()[0]; - rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); - rValue.Value <<= aPageSize; - rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); - rValue.Value <<= sal_False; + aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); + aRenderer[0].Value <<= aPageSize; + aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); + aRenderer[1].Value <<= sal_True; m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); -- cgit v1.2.3 From b3211d979c4aa6e8d50d10efb94fc639a6431d6d Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 27 Aug 2009 10:13:00 +0000 Subject: #101242# minor changes --- sw/source/core/view/vprint.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 98c58a66121a..7f5201c5e46d 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1268,10 +1268,9 @@ sal_Bool ViewShell::PrintOrPDFExport( { //TLPDF while( pStPage && !bStop ) { - if (nPage == 0) // post-it page - ::SetSwVisArea( rPrintData.GetPrintUIOptions().m_pPostItShell , pStPage->Frm() ); - else - ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); + ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ + rPrintData.GetPrintUIOptions().m_pPostItShell : pShell; + ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF // wenn wir einen Umschlag drucken wird ein Offset beachtet if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) @@ -1351,11 +1350,10 @@ sal_Bool ViewShell::PrintOrPDFExport( // TLPDF pShell->InitPrt( pOutDev, bIsPDFExport ? pOutDev : 0 ); pShell->InitPrt( pOutDev ); - if (nPage == 0) // post-it page - ::SetSwVisArea( rPrintData.GetPrintUIOptions().m_pPostItShell , pStPage->Frm() ); - else - ::SetSwVisArea( pShell, pStPage->Frm(), bIsPDFExport ); // TLPDF - nJobStartError = JOBSET_ERR_ISSTARTET; + ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ + rPrintData.GetPrintUIOptions().m_pPostItShell : pShell; + ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF +// TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages // TLPDF if ( rPrintData.bPrintEmptyPages || pStPage->Frm().Height() ) -- cgit v1.2.3 From bc18988ff86ca83d850fba993a669ff6b8253b5a Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 27 Aug 2009 12:29:52 +0000 Subject: #101242# SwRenderData introduced; minor name changes --- sw/inc/doc.hxx | 7 +-- sw/inc/printdata.hxx | 78 ++++++++++++++++++++------------- sw/inc/unotxdoc.hxx | 4 +- sw/source/core/doc/doc.cxx | 77 +++++++++++++++++---------------- sw/source/core/view/viewpg.cxx | 16 +++---- sw/source/core/view/vprint.cxx | 95 +++++++++++++++++++++++------------------ sw/source/ui/config/optpage.cxx | 22 +++++----- sw/source/ui/config/prtopt.cxx | 12 +++--- sw/source/ui/dbui/dbmgr.cxx | 62 +++++++++++++++++++-------- sw/source/ui/inc/cfgitems.hxx | 8 ++-- sw/source/ui/uiview/view.cxx | 2 +- sw/source/ui/uiview/viewprt.cxx | 7 +-- sw/source/ui/uno/unotxdoc.cxx | 47 ++++++++++++-------- 13 files changed, 253 insertions(+), 184 deletions(-) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 3f5ef569376b..52898ad0d1ad 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -218,6 +218,7 @@ class SwChartDataProvider; class SwChartLockController_Helper; class IGrammarContact; class SwPrintData; +class SwRenderData; class SwPageFrm; class SwViewOption; @@ -1339,11 +1340,11 @@ public: // get the set of printable pages for the XRenderable API by // evaluating the respective settings (see implementation) - void CalculatePagesForPrinting( /* out */ SwPrintUIOptions &rOptions, bool bIsPDFExport, + void CalculatePagesForPrinting( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport, sal_Int32 nDocPageCount ); - void UpdatePagesForPrintingWithPostItData( /* out */ SwPrintUIOptions &rOptions, bool bIsPDFExport, + void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport, sal_Int32 nDocPageCount ); - void CalculatePagePairsForProspectPrinting( /* out */ SwPrintUIOptions &rOptions, + void CalculatePagePairsForProspectPrinting( SwRenderData &rData, const SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ); sal_uInt16 GetPageCount() const; diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index e00ef66c977d..085121060c8e 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -50,10 +50,11 @@ class OutputDevice; //////////////////////////////////////////////////////////// -class SwPrintUIOptions : public vcl::PrinterOptionsHelper +// A class that stores temporary data that is needed for rendering the document. +// Usually this data is created when 'getRendererCount' is called and +// and it is used in the 'render' function of that same interface +class SwRenderData { - OutputDevice* m_pLast; - // pages valid for printing (according to the current settings) // and their respective start frames (see getRendererCount in unotxdoc.cxx) // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! @@ -79,19 +80,10 @@ public: SwDoc * m_pPostItDoc; ViewShell * m_pPostItShell; - public: - SwPrintUIOptions( BOOL bWeb = FALSE ); - ~SwPrintUIOptions(); - - bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + SwRenderData(); + ~SwRenderData(); - bool IsPrintLeftPages() const; - bool IsPrintRightPages() const; - bool IsPrintEmptyPages( bool bIsPDFExport ) const; - bool IsPrintTables() const; - bool IsPrintGraphics() const; - bool IsPrintDrawings() const; bool HasPostItData() const { return m_pPostItShell != 0 && m_pPostItDoc != 0 && m_pPostItShell != 0; } void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ); @@ -133,9 +125,32 @@ public: //////////////////////////////////////////////////////////// +class SwPrintUIOptions : public vcl::PrinterOptionsHelper +{ + OutputDevice* m_pLast; + +public: + SwPrintUIOptions( BOOL bWeb = FALSE ); + ~SwPrintUIOptions(); + + bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; + bool IsPrintEmptyPages( bool bIsPDFExport ) const; + bool IsPrintTables() const; + bool IsPrintGraphics() const; + bool IsPrintDrawings() const; +}; + + +//////////////////////////////////////////////////////////// + + class SwPrintData { - const SwPrintUIOptions * m_pPrintUIOptions; + const SwPrintUIOptions * m_pPrintUIOptions; // not owner + const SwRenderData * m_pRenderData; // not owner public: @@ -143,8 +158,8 @@ public: bPrintBlackFont, //#i81434# - printing of hidden text bPrintHiddenText, bPrintTextPlaceholder, - bPrintLeftPage, bPrintRightPage, bPrintReverse, bPrintProspect, - bPrintProspect_RTL, + bPrintLeftPages, bPrintRightPages, bPrintReverse, bPrintProspect, + bPrintProspectRTL, bPrintSingleJobs, bPaperFromSetup, // --> FME 2005-12-13 #b6354161# Print empty pages bPrintEmptyPages, @@ -159,13 +174,14 @@ public: SwPrintData() { m_pPrintUIOptions = NULL; + m_pRenderData = NULL; bPrintGraphic = bPrintTable = bPrintDraw = bPrintControl = - bPrintLeftPage = - bPrintRightPage = + bPrintLeftPages = + bPrintRightPages = bPrintPageBackground = bPrintEmptyPages = bUpdateFieldsInPrinting = sal_True; @@ -173,7 +189,7 @@ public: bPaperFromSetup = bPrintReverse = bPrintProspect = - bPrintProspect_RTL = + bPrintProspectRTL = bPrintSingleJobs = bModified = bPrintBlackFont = @@ -194,11 +210,11 @@ public: bPrintControl == rData.bPrintControl && bPrintPageBackground== rData.bPrintPageBackground&& bPrintBlackFont == rData.bPrintBlackFont && - bPrintLeftPage == rData.bPrintLeftPage && - bPrintRightPage == rData.bPrintRightPage && + bPrintLeftPages == rData.bPrintLeftPages && + bPrintRightPages == rData.bPrintRightPages && bPrintReverse == rData.bPrintReverse && bPrintProspect == rData.bPrintProspect && - bPrintProspect_RTL == rData.bPrintProspect_RTL && + bPrintProspectRTL == rData.bPrintProspectRTL && bPrintSingleJobs == rData.bPrintSingleJobs && bPaperFromSetup == rData.bPaperFromSetup && bPrintEmptyPages == rData.bPrintEmptyPages && @@ -209,22 +225,24 @@ public: bPrintTextPlaceholder == rData.bPrintTextPlaceholder; } - // Note: int the conntext where this class ist used the pointer should always be valid + // Note: in the context where this class ist used the pointers should always be valid // during the lifetime of this object const SwPrintUIOptions & GetPrintUIOptions() const { return *m_pPrintUIOptions; } - void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; } + void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; } + const SwRenderData & GetRenderData() const { return *m_pRenderData; } + void SetRenderData( const SwRenderData *pData ) { m_pRenderData = pData; } sal_Bool IsPrintGraphic() const { return bPrintGraphic; } sal_Bool IsPrintTable() const { return bPrintTable; } sal_Bool IsPrintDraw() const { return bPrintDraw; } sal_Bool IsPrintControl() const { return bPrintControl; } - sal_Bool IsPrintLeftPage() const { return bPrintLeftPage; } - sal_Bool IsPrintRightPage() const { return bPrintRightPage; } + sal_Bool IsPrintLeftPage() const { return bPrintLeftPages; } + sal_Bool IsPrintRightPage() const { return bPrintRightPages; } sal_Bool IsPrintReverse() const { return bPrintReverse; } sal_Bool IsPaperFromSetup() const { return bPaperFromSetup; } sal_Bool IsPrintEmptyPages() const{ return bPrintEmptyPages; } sal_Bool IsPrintProspect() const { return bPrintProspect; } - sal_Bool IsPrintProspect_RTL() const { return bPrintProspect_RTL; } + sal_Bool IsPrintProspectRTL() const { return bPrintProspectRTL; } sal_Bool IsPrintPageBackground() const { return bPrintPageBackground; } sal_Bool IsPrintBlackFont() const { return bPrintBlackFont;} sal_Bool IsPrintSingleJobs() const { return bPrintSingleJobs;} @@ -237,8 +255,8 @@ public: void SetPrintTable ( sal_Bool b ) { doSetModified(); bPrintTable = b;} void SetPrintDraw ( sal_Bool b ) { doSetModified(); bPrintDraw = b;} void SetPrintControl ( sal_Bool b ) { doSetModified(); bPrintControl = b; } - void SetPrintLeftPage ( sal_Bool b ) { doSetModified(); bPrintLeftPage = b;} - void SetPrintRightPage( sal_Bool b ) { doSetModified(); bPrintRightPage = b;} + void SetPrintLeftPage ( sal_Bool b ) { doSetModified(); bPrintLeftPages = b;} + void SetPrintRightPage( sal_Bool b ) { doSetModified(); bPrintRightPages = b;} void SetPrintReverse ( sal_Bool b ) { doSetModified(); bPrintReverse = b;} void SetPaperFromSetup( sal_Bool b ) { doSetModified(); bPaperFromSetup = b;} void SetPrintEmptyPages(sal_Bool b ) { doSetModified(); bPrintEmptyPages = b;} diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 19b32df6c255..f2ec7fc21d01 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -127,6 +127,7 @@ class SwXDocumentPropertyHelper; class SfxViewFrame; class SwPrintUIOptions; class SwPrintData; +class SwRenderData; typedef UnoActionContext* UnoActionContextPtr; SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) @@ -221,7 +222,8 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, css::uno::Reference< css::uno::XInterface> xPropertyHelper; SwXDocumentPropertyHelper* pPropertyHelper; - SwPrintUIOptions* m_pPrintUIOptions; + SwPrintUIOptions * m_pPrintUIOptions; + SwRenderData * m_pRenderData; void GetBodyText(); void GetNumberFormatter(); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 9a730106ea80..daefe8fef56f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1136,7 +1136,8 @@ static void lcl_FormatPostIt( void SwDoc::CalculatePagesForPrinting( - /* out */ SwPrintUIOptions &rOptions, + /* out */ SwRenderData &rData, + const SwPrintUIOptions &rOptions, bool bIsPDFExport, sal_Int32 nDocPageCount ) { @@ -1222,8 +1223,8 @@ void SwDoc::CalculatePagesForPrinting( #endif // TL_NOT_NOW /*TLPDF*/ nPageNo = nFirstPageNo; - std::set< sal_Int32 > &rValidPages = rOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrames(); + std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); rValidPages.clear(); rValidStartFrms.clear(); while ( pStPage ) @@ -1292,38 +1293,39 @@ void SwDoc::CalculatePagesForPrinting( aPageRange += OUString::valueOf( (sal_Unicode)'-'); aPageRange += OUString::valueOf( nDocPageCount ); } - rOptions.SetPageRange( aPageRange ); + rData.SetPageRange( aPageRange ); // get vector of pages to print according to PageRange and valid pages set from above // (result may be an empty vector, for example if the range string is not correct) StringRangeEnumerator::getRangesFromString( - aPageRange, rOptions.GetPagesToPrint(), - 1, nDocPageCount, 0, &rOptions.GetValidPagesSet() ); + aPageRange, rData.GetPagesToPrint(), + 1, nDocPageCount, 0, &rData.GetValidPagesSet() ); } void SwDoc::UpdatePagesForPrintingWithPostItData( - /* out */ SwPrintUIOptions &rOptions, + /* out */ SwRenderData &rData, + const SwPrintUIOptions &rOptions, bool /*bIsPDFExport*/, sal_Int32 nDocPageCount ) { sal_Int16 nPostItMode = (sal_Int16) rOptions.getIntValue( "PrintAnnotationMode", 0 ); - DBG_ASSERT(nPostItMode == POSTITS_NONE || rOptions.HasPostItData(), + DBG_ASSERT(nPostItMode == POSTITS_NONE || rData.HasPostItData(), "print post-its without post-it data?" ); - const USHORT nPostItCount = rOptions.HasPostItData() ? rOptions.m_pPostItFields->Count() : 0; + const USHORT nPostItCount = rData.HasPostItData() ? rData.m_pPostItFields->Count() : 0; if (nPostItMode != POSTITS_NONE && nPostItCount > 0) { - SET_CURR_SHELL( rOptions.m_pPostItShell ); + SET_CURR_SHELL( rData.m_pPostItShell ); // clear document and move to end of it - SwPaM aPam( rOptions.m_pPostItDoc->GetNodes().GetEndOfContent() ); + SwPaM aPam( rData.m_pPostItDoc->GetNodes().GetEndOfContent() ); aPam.Move( fnMoveBackward, fnGoDoc ); aPam.SetMark(); aPam.Move( fnMoveForward, fnGoDoc ); - rOptions.m_pPostItDoc->Delete( aPam ); + rData.m_pPostItDoc->Delete( aPam ); - const StringRangeEnumerator aRangeEnum( rOptions.GetPageRange(), 1, nDocPageCount, 0 ); + const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); // For mode POSTITS_ENDPAGE: // maps a physical page number to the page number in post-it document that holds @@ -1339,10 +1341,10 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( bool bIsFirstPostIt = true; for (USHORT i = 0; i < nPostItCount; ++i) { - _PostItFld& rPostIt = (_PostItFld&)*(*rOptions.m_pPostItFields)[ i ]; + _PostItFld& rPostIt = (_PostItFld&)*(*rData.m_pPostItFields)[ i ]; nLastPageNum = nPhyPageNum; nPhyPageNum = rPostIt.GetPageNo( - aRangeEnum, rOptions.GetValidPagesSet(), + aRangeEnum, rData.GetValidPagesSet(), true /*TLPDF bRgt*/, true /*TLPDF bLft*/, nVirtPg, nLineNo ); if (nPhyPageNum) { @@ -1352,55 +1354,55 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( const bool bNewPage = nPostItMode == POSTITS_ENDPAGE && !bIsFirstPostIt && nPhyPageNum != nLastPageNum; - lcl_FormatPostIt( rOptions.m_pPostItShell->GetDoc(), aPam, + lcl_FormatPostIt( rData.m_pPostItShell->GetDoc(), aPam, rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo ); bIsFirstPostIt = false; if (nPostItMode == POSTITS_ENDPAGE) { // get the correct number of current pages for the post-it document - rOptions.m_pPostItShell->CalcLayout(); - const sal_Int32 nPages = rOptions.m_pPostItDoc->GetPageCount(); + rData.m_pPostItShell->CalcLayout(); + const sal_Int32 nPages = rData.m_pPostItDoc->GetPageCount(); aPostItLastStartPageNum[ nPhyPageNum ] = nPages; } } } // format post-it doc to get correct number of pages - rOptions.m_pPostItShell->CalcLayout(); - const sal_Int32 nPostItDocPageCount = rOptions.m_pPostItDoc->GetPageCount(); + rData.m_pPostItShell->CalcLayout(); + const sal_Int32 nPostItDocPageCount = rData.m_pPostItDoc->GetPageCount(); if (nPostItMode == POSTITS_ONLY || nPostItMode == POSTITS_ENDDOC) { // now add those post-it pages to the vector of pages to print // or replace them if only post-its should be printed - rOptions.GetPostItStartFrames().clear(); + rData.GetPostItStartFrames().clear(); if (nPostItMode == POSTITS_ENDDOC) { // set all values up to number of pages to print currently known to NULL, // meaning none of the pages currently in the vector is from the // post-it document, they are the documents pages. - rOptions.GetPostItStartFrames().resize( rOptions.GetPagesToPrint().size() ); + rData.GetPostItStartFrames().resize( rData.GetPagesToPrint().size() ); } else if (nPostItMode == POSTITS_ONLY) { // no document page to be printed - rOptions.GetPagesToPrint().clear(); + rData.GetPagesToPrint().clear(); } // now we just need to add the post-it pages to be printed to the end // of the vector of pages to print and keep the GetValidStartFrames // data conform with it sal_Int32 nPageNum = 0; - const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); + const SwPageFrm * pPageFrm = (SwPageFrm*)rData.m_pPostItShell->GetLayout()->Lower(); while( pPageFrm && nPageNum < nPostItDocPageCount ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); ++nPageNum; - rOptions.GetPagesToPrint().push_back( 0 ); // a page number of 0 indicates this page is from the post-it doc + rData.GetPagesToPrint().push_back( 0 ); // a page number of 0 indicates this page is from the post-it doc DBG_ASSERT( pPageFrm, "pPageFrm is NULL!" ); - rOptions.GetPostItStartFrames().push_back( pPageFrm ); + rData.GetPostItStartFrames().push_back( pPageFrm ); pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); } DBG_ASSERT( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); @@ -1414,7 +1416,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // ... thus, first collect all post-it doc start frames in a vector sal_Int32 nPostItPageNum = 0; std::vector< const SwPageFrm * > aAllPostItStartFrames; - const SwPageFrm * pPageFrm = (SwPageFrm*)rOptions.m_pPostItShell->GetLayout()->Lower(); + const SwPageFrm * pPageFrm = (SwPageFrm*)rData.m_pPostItShell->GetLayout()->Lower(); while( pPageFrm && sal_Int32(aAllPostItStartFrames.size()) < nPostItDocPageCount ) { DBG_ASSERT( pPageFrm, "Empty page frame. How are we going to print this?" ); @@ -1457,11 +1459,11 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // isn't that efficient we will create new vectors by copying the required data std::vector< sal_Int32 > aTmpPagesToPrint; std::vector< const SwPageFrm * > aTmpPostItStartFrames; - const size_t nNum = rOptions.GetPagesToPrint().size(); + const size_t nNum = rData.GetPagesToPrint().size(); for (size_t i = 0 ; i < nNum; ++i) { // add the physical page to print from the document - const sal_Int32 nPhysPage = rOptions.GetPagesToPrint()[i]; + const sal_Int32 nPhysPage = rData.GetPagesToPrint()[i]; aTmpPagesToPrint.push_back( nPhysPage ); aTmpPostItStartFrames.push_back( NULL ); @@ -1479,20 +1481,21 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // finally we need to assign those vectors to the resulting ones. // swapping the data should be more efficient than assigning since // we won't need the temporary vectors anymore - rOptions.GetPagesToPrint().swap( aTmpPagesToPrint ); - rOptions.GetPostItStartFrames().swap( aTmpPostItStartFrames ); + rData.GetPagesToPrint().swap( aTmpPagesToPrint ); + rData.GetPostItStartFrames().swap( aTmpPostItStartFrames ); } } } void SwDoc::CalculatePagePairsForProspectPrinting( - SwPrintUIOptions &rOptions, + /* out */ SwRenderData &rData, + const SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { - std::set< sal_Int32 > &rValidPagesSet = rOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrames(); - std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rOptions.GetPagePairsForProspectPrinting(); + std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); + std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rData.GetPagePairsForProspectPrinting(); rPagePairs.clear(); rValidPagesSet.clear(); @@ -1534,7 +1537,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now //TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); - bool bPrintProspect_RTL = rOptions.getIntValue( "PrintProspectRTL", 0 ) ? true : false; + bool bPrintProspectRTL = rOptions.getIntValue( "PrintProspectRTL", 0 ) ? true : false; // get pages for prospect printing according to the 'PageRange' // (duplicates and any order allowed!) @@ -1621,7 +1624,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( pStPage = aVec[ nSPg ]; const SwPageFrm* pNxtPage = nEPg < aVec.size() ? aVec[ nEPg ] : 0; - short nRtlOfs = bPrintProspect_RTL ? 1 : 0; + short nRtlOfs = bPrintProspectRTL ? 1 : 0; if ( 0 == (( nSPg + nRtlOfs) & 1 ) ) // switch for odd number in LTR, even number in RTL { const SwPageFrm* pTmp = pStPage; diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 79dbdfc1f962..c0b5987e0046 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -481,7 +481,7 @@ void ViewShell::PrintProspect( { // TLPDF if( !rOptions.aMulti.GetSelectCount() ) Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); - if (!pPrinter || rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting().size() <= 0) + if (!pPrinter || rPrintData.GetRenderData().GetPagePairsForProspectPrinting().size() <= 0) return; #ifdef TL_NOT_NOW /*TLPDF*/ @@ -498,15 +498,15 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetRenderData().GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); #endif std::pair< sal_Int32, sal_Int32 > rPagesToPrint = - rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting()[ nRenderer ]; + rPrintData.GetRenderData().GetPagePairsForProspectPrinting()[ nRenderer ]; const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? rPagesToPrint.first : rPagesToPrint.second); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( rPagesToPrint.first == -1 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); - DBG_ASSERT( rPagesToPrint.second == -1 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); + DBG_ASSERT( rPagesToPrint.first == -1 || rPrintData.GetRenderData().GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); + DBG_ASSERT( rPagesToPrint.second == -1 || rPrintData.GetRenderData().GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); #endif /* TLPDF neu: end */ @@ -703,16 +703,16 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ const SwPageFrm *pStPage = 0; const SwPageFrm *pNxtPage = 0; - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrames(); + const SwRenderData::ValidStartFramesMap_t &rFrms = rPrintData.GetRenderData().GetValidStartFrames(); if (rPagesToPrint.first > 0) { - SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); + SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); pStPage = aIt->second; } if (rPagesToPrint.second > 0) { - SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.second ) ); + SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.second ) ); DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); pNxtPage = aIt->second; } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 7f5201c5e46d..08a19e307ae5 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -237,6 +237,52 @@ const XubString& SwPrtOptions::MakeNextJobName() return sJobName += XubString::CreateFromInt32( ++nJobNo ); } +/*****************************************************************************/ + + +SwRenderData::SwRenderData() +{ + m_pPostItFields = 0; + m_pPostItDoc = 0; + m_pPostItShell = 0; +} + + +SwRenderData::~SwRenderData() +{ +} + + +void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) +{ + m_pPostItFields = new _SetGetExpFlds; + lcl_GetPostIts( pDoc, *m_pPostItFields ); + m_pPostItDoc = new SwDoc; + + //!! Disable spell and grammar checking in the temporary document. + //!! Otherwise the grammar checker might process it and crash if we later on + //!! simply delete this document while he is still at it. + SwViewOption aViewOpt( *pViewOpt ); + aViewOpt.SetOnlineSpell( FALSE ); + + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); +} + + +void SwRenderData::DeletePostItData() +{ + if (HasPostItData()) + { + m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt + delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. + delete m_pPostItFields; + m_pPostItDoc = 0; + m_pPostItShell = 0; + m_pPostItFields = 0; + } +} + + /*****************************************************************************/ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : @@ -428,10 +474,6 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); - - m_pPostItFields = 0; - m_pPostItDoc = 0; - m_pPostItShell = 0; } @@ -526,35 +568,6 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un } -void SwPrintUIOptions::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) -{ - m_pPostItFields = new _SetGetExpFlds; - lcl_GetPostIts( pDoc, *m_pPostItFields ); - m_pPostItDoc = new SwDoc; - - //!! Disable spell and grammar checking in the temporary document. - //!! Otherwise the grammar checker might process it and crash if we later on - //!! simply delete this document while he is still at it. - SwViewOption aViewOpt( *pViewOpt ); - aViewOpt.SetOnlineSpell( FALSE ); - - m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); -} - - -void SwPrintUIOptions::DeletePostItData() -{ - if (HasPostItData()) - { - m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt - delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. - delete m_pPostItFields; - m_pPostItDoc = 0; - m_pPostItShell = 0; - m_pPostItFields = 0; - } -} - /****************************************************************************** * Methode : void SetSwVisArea( ViewShell *pSh, Point aPrtOffset, ... * Beschreibung: @@ -1158,17 +1171,17 @@ sal_Bool ViewShell::PrintOrPDFExport( /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetPrintUIOptions().GetPagesToPrint().size(), "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetRenderData().GetPagesToPrint().size(), "nRenderer out of bounds"); #endif - const sal_Int32 nPage = rPrintData.GetPrintUIOptions().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ + const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( nPage == 0 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); + DBG_ASSERT( nPage == 0 || rPrintData.GetRenderData().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif const SwPageFrm *pStPage = 0; if (nPage > 0) // a 'regular' page, not one from the post-it document { - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrames(); - SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); + const SwRenderData::ValidStartFramesMap_t &rFrms = rPrintData.GetRenderData().GetValidStartFrames(); + SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); if (aIt == rFrms.end()) return sal_False; @@ -1177,7 +1190,7 @@ sal_Bool ViewShell::PrintOrPDFExport( else // a page from the post-its document ... { DBG_ASSERT( nPage == 0, "unexpected page number. 0 for post-it pages expected" ); - pStPage = rPrintData.GetPrintUIOptions().GetPostItStartFrames()[ nRenderer ]; + pStPage = rPrintData.GetRenderData().GetPostItStartFrames()[ nRenderer ]; } DBG_ASSERT( pStPage, "failed to get start page" ); /* TLPDF neu: end */ @@ -1269,7 +1282,7 @@ sal_Bool ViewShell::PrintOrPDFExport( //TLPDF while( pStPage && !bStop ) { ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ - rPrintData.GetPrintUIOptions().m_pPostItShell : pShell; + rPrintData.GetRenderData().m_pPostItShell : pShell; ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF // wenn wir einen Umschlag drucken wird ein Offset beachtet @@ -1351,7 +1364,7 @@ sal_Bool ViewShell::PrintOrPDFExport( pShell->InitPrt( pOutDev ); ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ - rPrintData.GetPrintUIOptions().m_pPostItShell : pShell; + rPrintData.GetRenderData().m_pPostItShell : pShell; ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF // TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; } diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 4b85042d0003..3c529263f66d 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -473,14 +473,14 @@ BOOL SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet ) aAddPrinterAttr.bPrintHiddenText = aPrintHiddenTextCB.IsChecked(); aAddPrinterAttr.bPrintTextPlaceholder = aPrintTextPlaceholderCB.IsChecked(); - aAddPrinterAttr.bPrintLeftPage = aLeftPageCB.IsChecked(); - aAddPrinterAttr.bPrintRightPage = aRightPageCB.IsChecked(); - aAddPrinterAttr.bPrintReverse = aReverseCB.IsChecked(); - aAddPrinterAttr.bPrintProspect = aProspectCB.IsChecked(); - aAddPrinterAttr.bPrintProspect_RTL = aProspectCB_RTL.IsChecked(); - aAddPrinterAttr.bPaperFromSetup = aPaperFromSetupCB.IsChecked(); - aAddPrinterAttr.bPrintEmptyPages = aPrintEmptyPagesCB.IsChecked(); - aAddPrinterAttr.bPrintSingleJobs = aSingleJobsCB.IsChecked(); + aAddPrinterAttr.bPrintLeftPages = aLeftPageCB.IsChecked(); + aAddPrinterAttr.bPrintRightPages = aRightPageCB.IsChecked(); + aAddPrinterAttr.bPrintReverse = aReverseCB.IsChecked(); + aAddPrinterAttr.bPrintProspect = aProspectCB.IsChecked(); + aAddPrinterAttr.bPrintProspectRTL = aProspectCB_RTL.IsChecked(); + aAddPrinterAttr.bPaperFromSetup = aPaperFromSetupCB.IsChecked(); + aAddPrinterAttr.bPrintEmptyPages = aPrintEmptyPagesCB.IsChecked(); + aAddPrinterAttr.bPrintSingleJobs = aSingleJobsCB.IsChecked(); if (aNoRB.IsChecked()) aAddPrinterAttr.nPrintPostIts = POSTITS_NONE; @@ -516,13 +516,13 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet& ) aBlackFontCB.Check( pAddPrinterAttr->bPrintBlackFont); aPrintHiddenTextCB.Check( pAddPrinterAttr->bPrintHiddenText); aPrintTextPlaceholderCB.Check(pAddPrinterAttr->bPrintTextPlaceholder); - aLeftPageCB.Check( pAddPrinterAttr->bPrintLeftPage); - aRightPageCB.Check( pAddPrinterAttr->bPrintRightPage); + aLeftPageCB.Check( pAddPrinterAttr->bPrintLeftPages); + aRightPageCB.Check( pAddPrinterAttr->bPrintRightPages); aReverseCB.Check( pAddPrinterAttr->bPrintReverse); aPaperFromSetupCB.Check(pAddPrinterAttr->bPaperFromSetup); aPrintEmptyPagesCB.Check(pAddPrinterAttr->bPrintEmptyPages); aProspectCB.Check( pAddPrinterAttr->bPrintProspect); - aProspectCB_RTL.Check( pAddPrinterAttr->bPrintProspect_RTL); + aProspectCB_RTL.Check( pAddPrinterAttr->bPrintProspectRTL); aSingleJobsCB.Check( pAddPrinterAttr->bPrintSingleJobs); aNoRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ; diff --git a/sw/source/ui/config/prtopt.cxx b/sw/source/ui/config/prtopt.cxx index 41a118614b95..ceb48b6adefe 100644 --- a/sw/source/ui/config/prtopt.cxx +++ b/sw/source/ui/config/prtopt.cxx @@ -119,13 +119,13 @@ SwPrintOptions::SwPrintOptions(sal_Bool bWeb) : break; case 6: bPrintReverse = *(sal_Bool*)pValues[nProp].getValue(); break; case 7: bPrintProspect = *(sal_Bool*)pValues[nProp].getValue(); break; - case 8: bPrintProspect_RTL = *(sal_Bool*)pValues[nProp].getValue(); break; + case 8: bPrintProspectRTL = *(sal_Bool*)pValues[nProp].getValue(); break; case 9: bPrintSingleJobs = *(sal_Bool*)pValues[nProp].getValue(); break; case 10: pValues[nProp] >>= sFaxName; break; case 11: bPaperFromSetup = *(sal_Bool*)pValues[nProp].getValue(); break; case 12: bPrintDraw = *(sal_Bool*)pValues[nProp].getValue() ; break; - case 13: bPrintLeftPage = *(sal_Bool*)pValues[nProp].getValue(); break; - case 14: bPrintRightPage = *(sal_Bool*)pValues[nProp].getValue(); break; + case 13: bPrintLeftPages = *(sal_Bool*)pValues[nProp].getValue(); break; + case 14: bPrintRightPages = *(sal_Bool*)pValues[nProp].getValue(); break; case 15: bPrintEmptyPages = *(sal_Bool*)pValues[nProp].getValue(); break; case 16: bPrintTextPlaceholder = *(sal_Bool*)pValues[nProp].getValue(); break; case 17: bPrintHiddenText = *(sal_Bool*)pValues[nProp].getValue(); break; @@ -164,13 +164,13 @@ void SwPrintOptions::Commit() case 5: pValues[nProp] <<= (sal_Int32)nPrintPostIts ; break; case 6: bVal = bPrintReverse ; pValues[nProp].setValue(&bVal, rType); break; case 7: bVal = bPrintProspect ; pValues[nProp].setValue(&bVal, rType); break; - case 8: bVal = bPrintProspect_RTL ; pValues[nProp].setValue(&bVal, rType); break; + case 8: bVal = bPrintProspectRTL ; pValues[nProp].setValue(&bVal, rType); break; case 9: bVal = bPrintSingleJobs ; pValues[nProp].setValue(&bVal, rType); break; case 10: pValues[nProp] <<= sFaxName; break; case 11: bVal = bPaperFromSetup ; pValues[nProp].setValue(&bVal, rType); break; case 12: bVal = bPrintDraw ; pValues[nProp].setValue(&bVal, rType); break; - case 13: bVal = bPrintLeftPage ; pValues[nProp].setValue(&bVal, rType); break; - case 14: bVal = bPrintRightPage ; pValues[nProp].setValue(&bVal, rType); break; + case 13: bVal = bPrintLeftPages ; pValues[nProp].setValue(&bVal, rType); break; + case 14: bVal = bPrintRightPages ; pValues[nProp].setValue(&bVal, rType); break; case 15: bVal = bPrintEmptyPages ; pValues[nProp].setValue(&bVal, rType); break; case 16: bVal = bPrintTextPlaceholder; pValues[nProp].setValue(&bVal, rType); break; case 17: bVal = bPrintHiddenText; pValues[nProp].setValue(&bVal, rType); break; diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index a5cfd66a740a..ff29ca8638e2 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -458,6 +458,7 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) case DBMGR_MERGE_MAILMERGE: // Serienbrief { SwView& rView = rMergeDesc.rSh.GetView(); +#ifdef TL_NOT_NOW /*TLPDF*/ SfxDispatcher *pDis = rView.GetViewFrame()->GetDispatcher(); SfxItemSet aPrintArgs( rView.GetPool(), SID_SILENT, SID_SILENT, //5528 @@ -522,9 +523,42 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) } } - pDis->Execute( SID_PRINTDOC, - SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, - aPrintArgs ); +#endif //def TL_NOT_NOW /*TLPDF*/ + +// TLPDF pDis->Execute( SID_PRINTDOC, +// TLPDF SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, +// TLPDF aPrintArgs ); +#if OSL_DEBUG_LEVEL > 1 + sal_Bool _bVal; + sal_Int16 _nVal; + rtl::OUString _sVal; + const beans::PropertyValue* pPrintOptions = rMergeDesc.aPrintOptions.getConstArray(); + for( sal_Int32 nOption = 0; nOption < rMergeDesc.aPrintOptions.getLength(); ++nOption) + { + rtl::OUString aName( pPrintOptions[nOption].Name ); + uno::Any aVal( pPrintOptions[nOption].Value ); + aVal >>= _bVal; + aVal >>= _nVal; + aVal >>= _sVal; + } +#endif + + // printing should be done synchronous otherwise the document + // might already become invalid during the process + uno::Sequence< beans::PropertyValue > aOptions( rMergeDesc.aPrintOptions ); + const sal_Int32 nOpts = aOptions.getLength(); + aOptions.realloc( nOpts + 1 ); + aOptions[ nOpts ].Name = rtl::OUString::createFromAscii( "Wait" ); + aOptions[ nOpts ].Value <<= sal_True ; + + const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); + if (pModOpt->IsSinglePrintJob()) + { + } + else + { + rView.ExecPrint( aOptions, sal_False, sal_False ); + } } break; @@ -858,12 +892,9 @@ SwNewDBMgr::~SwNewDBMgr() --------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, - SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) +BOOL SwNewDBMgr::MergePrint( SwView& rView, + SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) { - DBG_ASSERT( 0, "not implemented" ); - return FALSE; -#ifdef TL_NOT_NOW /* TLPDF */ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section BOOL bSynchronizedDoc = pSh->IsLabelDoc() && pSh->GetSectionFmtCount() > 1; @@ -971,11 +1002,11 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, } if( pPrt->IsJobActive() ) { - pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspect_RTL() ); /* TLPDF */ + pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); /* TLPDF */ bRet = TRUE; } #endif // TL_NOT_NOW /*TLPDF*/ - pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF + pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); // TLPDF bRet = TRUE; // TLPDF } else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, rOpt ) /* TLPDF */ ) @@ -1027,17 +1058,13 @@ BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, } return bRet; -#endif // TL_NOT_NOW /* TLPDF */ } /*-- 21.06.2004 09:08:16--------------------------------------------------- -----------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, - SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) +BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, + SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) { - DBG_ASSERT( 0, "not implemented" ); - return FALSE; -#ifdef TL_NOT_NOW /* TLPDF */ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section //merge source is already open @@ -1144,7 +1171,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, { //TLPDF if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) //TLPDF { - pSh->PrintProspectMM( aPrtAdaptor, aAddViewProperties, rOpt, rOpt.IsPrintProspect_RTL() ); + pSh->PrintProspectMM( aPrtAdaptor, aAddViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); bRet = TRUE; //TLPDF } } @@ -1192,7 +1219,6 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, } return bRet; -#endif // TL_NOT_NOW /* TLPDF */ } diff --git a/sw/source/ui/inc/cfgitems.hxx b/sw/source/ui/inc/cfgitems.hxx index 620d3ac52b23..bb301283a005 100644 --- a/sw/source/ui/inc/cfgitems.hxx +++ b/sw/source/ui/inc/cfgitems.hxx @@ -155,15 +155,15 @@ public: BOOL IsPrintProspect() const { return bPrintProspect; } - BOOL IsPrintProspect_RTL() const { return bPrintProspect_RTL; } + BOOL IsPrintProspectRTL() const { return bPrintProspectRTL; } void SetPrintProspect(BOOL bFlag ){ bPrintProspect = bFlag; } - void SetPrintProspect_RTL(BOOL bFlag ){ bPrintProspect_RTL = bFlag; } + void SetPrintProspectRTL(BOOL bFlag ){ bPrintProspectRTL = bFlag; } BOOL IsPrintGraphic () const { return bPrintGraphic; } BOOL IsPrintTable () const { return bPrintTable; } BOOL IsPrintDraw () const { return bPrintDraw; } BOOL IsPrintControl () const { return bPrintControl; } - BOOL IsPrintLeftPage () const { return bPrintLeftPage; } - BOOL IsPrintRightPage() const { return bPrintRightPage; } + BOOL IsPrintLeftPage () const { return bPrintLeftPages; } + BOOL IsPrintRightPage() const { return bPrintRightPages; } BOOL IsPrintReverse () const { return bPrintReverse; } BOOL IsPaperFromSetup() const { return bPaperFromSetup; } BOOL IsPrintEmptyPages() const { return bPrintEmptyPages; } diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 5e3afd2ed8fa..642c34352a0e 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1975,7 +1975,7 @@ void SwView::MakeOptions( PrintDialog* pDlg, SwPrtOptions& rOpts, if( pPrtProspect ) *pPrtProspect = pData->bPrintProspect; if( pPrtProspect_RTL ) - *pPrtProspect_RTL = pData->bPrintProspect_RTL; + *pPrtProspect_RTL = pData->bPrintProspectRTL; rOpts.aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); rOpts.aMulti.SelectAll( FALSE ); rOpts.nCopyCount = 1; diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index b6f2308d9888..4a7e6477aa7f 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -178,10 +178,6 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, BOOL bIsAPI ) { - (void) pPrinter; (void) pDlg; (void) bSilent; (void) bIsAPI; - DBG_ASSERT( 0, "not implemented" ); - return 0; -#ifdef TL_NOT_NOW /* TLPDF */ // First test SwWrtShell* pSh = &GetWrtShell(); SwNewDBMgr* pMgr = pSh->GetNewDBMgr(); @@ -376,7 +372,7 @@ ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, pViewProperties[10].Value <<= (text::NotePrintMode) aOpts.GetPrintPostIts(); pViewProperties[11].Name = C2U("PrintProspect"); pViewProperties[11].Value <<= (sal_Bool)aOpts.IsPrintProspect(); - pViewProperties[12].Name = C2U("PrintPageBackground"); + pViewProperties[12].Name = C2U("PrintPageBackground"); pViewProperties[12].Value <<= (sal_Bool)aOpts.IsPrintPageBackground(); pViewProperties[13].Name = C2U("PrintBlackFonts"); pViewProperties[13].Value <<= (sal_Bool)aOpts.IsPrintBlackFont(); @@ -447,7 +443,6 @@ ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, //TLPDF pProgress->DeleteOnEndPrint(); //TLPDF pPrinter->EndJob(); return pPrinter->GetError(); -#endif // TL_NOT_NOW /* TLPDF */ } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 3b774180dd63..46696961dca4 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -360,7 +360,8 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : pxLinkTargetSupplier(0), pxXRedlines(0), m_pHiddenViewFrame(0), - m_pPrintUIOptions( NULL ) + m_pPrintUIOptions( NULL ), + m_pRenderData( NULL ) { } /*-- 18.12.98 11:53:00--------------------------------------------------- @@ -376,6 +377,7 @@ SwXTextDocument::~SwXTextDocument() xNumFmtAgg = 0; } delete m_pPrintUIOptions; + delete m_pRenderData; } @@ -2626,6 +2628,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); + if( ! m_pRenderData ) + m_pRenderData = new SwRenderData; if( ! m_pPrintUIOptions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); @@ -2680,8 +2684,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); if (bPrintProspect) { - pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); - nRet = m_pPrintUIOptions->GetPagePairsForProspectPrinting().size(); + pDoc->CalculatePagePairsForProspectPrinting( *m_pRenderData, *m_pPrintUIOptions, nPageCount ); + nRet = m_pRenderData->GetPagePairsForProspectPrinting().size(); } else { @@ -2689,20 +2693,20 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (nPostItMode != POSTITS_NONE) { OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); - m_pPrintUIOptions->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev ); + m_pRenderData->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev ); } // get set of valid document pages (according to the current settings) // and their start frames - pDoc->CalculatePagesForPrinting( *m_pPrintUIOptions, bIsPDFExport, nPageCount ); + pDoc->CalculatePagesForPrinting( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); if (nPostItMode != POSTITS_NONE) { - pDoc->UpdatePagesForPrintingWithPostItData( + pDoc->UpdatePagesForPrintingWithPostItData( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); } - nRet = m_pPrintUIOptions->GetPagesToPrint().size(); + nRet = m_pRenderData->GetPagesToPrint().size(); } DBG_ASSERT( nRet >= 0, "negative number of pages???" ); @@ -2721,6 +2725,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if(!IsValid()) throw RuntimeException(); + if( ! m_pRenderData ) + m_pRenderData = new SwRenderData; if( ! m_pPrintUIOptions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); @@ -2812,6 +2818,8 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); + if (!m_pRenderData) + m_pRenderData = new SwRenderData; if (!m_pPrintUIOptions) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); @@ -2846,8 +2854,8 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) - || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagesToPrint().size())) + if ( (bPrintProspect && size_t(nRenderer) >= m_pRenderData->GetPagePairsForProspectPrinting().size()) + || (!bPrintProspect && size_t(nRenderer) >= m_pRenderData->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export @@ -2885,15 +2893,15 @@ void SAL_CALL SwXTextDocument::render( aOptions.bPrintTable = m_pPrintUIOptions->IsPrintTables(); aOptions.bPrintDraw = m_pPrintUIOptions->IsPrintDrawings(); aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( "PrintControls", aOptions.bPrintControl ); - aOptions.bPrintLeftPage = m_pPrintUIOptions->IsPrintLeftPages(); - aOptions.bPrintRightPage = m_pPrintUIOptions->IsPrintRightPages(); + aOptions.bPrintLeftPages = m_pPrintUIOptions->IsPrintLeftPages(); + aOptions.bPrintRightPages = m_pPrintUIOptions->IsPrintRightPages(); aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( "PrintPageBackground", aOptions.bPrintPageBackground ); aOptions.bPrintEmptyPages = !bIsSkipEmptyPages; // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", aOptions.bPaperFromSetup ); aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( "PrintReversed", aOptions.bPrintReverse ); aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", aOptions.bPrintProspect ); - aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspect_RTL ) ? true : false; + aOptions.bPrintProspectRTL = m_pPrintUIOptions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspectRTL ) ? true : false; // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( "PrintBlackFonts", aOptions.bPrintBlackFont ); @@ -2901,9 +2909,10 @@ void SAL_CALL SwXTextDocument::render( aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintTextPlaceholder", aOptions.bPrintTextPlaceholder ); aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", aOptions.nPrintPostIts )); - //! needs to be set after MakeOptions since the assingment operation in that - //! function will destroy this pointer + //! needs to be set after MakeOptions since the assignment operation in that + //! function will destroy the pointers aOptions.SetPrintUIOptions( m_pPrintUIOptions ); + aOptions.SetRenderData( m_pRenderData ); Range aRange( nRenderer+1, nRenderer+1 ); MultiSelection aPages( aRange ); @@ -2967,16 +2976,18 @@ void SAL_CALL SwXTextDocument::render( if (bLastPage) { - if (m_pPrintUIOptions->HasPostItData()) - m_pPrintUIOptions->DeletePostItData(); - + if (m_pRenderData && m_pRenderData->HasPostItData()) + m_pRenderData->DeletePostItData(); if (m_pHiddenViewFrame) { lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); m_pHiddenViewFrame = 0; } + + aOptions.SetRenderData( NULL ); aOptions.SetPrintUIOptions( NULL ); - delete m_pPrintUIOptions, m_pPrintUIOptions = NULL; + delete m_pRenderData; m_pRenderData = NULL; + delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; } } } -- cgit v1.2.3 From 0dbda8a93911a7bbed0faa078626036fb3077499 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 28 Aug 2009 13:54:50 +0000 Subject: fix warning --- sw/source/core/view/vprint.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 08a19e307ae5..b1f3c8e88eaf 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -256,8 +256,8 @@ SwRenderData::~SwRenderData() void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) { m_pPostItFields = new _SetGetExpFlds; - lcl_GetPostIts( pDoc, *m_pPostItFields ); - m_pPostItDoc = new SwDoc; + lcl_GetPostIts( pDoc, *m_pPostItFields ); + m_pPostItDoc = new SwDoc; //!! Disable spell and grammar checking in the temporary document. //!! Otherwise the grammar checker might process it and crash if we later on @@ -265,7 +265,7 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, SwViewOption aViewOpt( *pViewOpt ); aViewOpt.SetOnlineSpell( FALSE ); - m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); + m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev ); } @@ -1216,7 +1216,7 @@ sal_Bool ViewShell::PrintOrPDFExport( ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { // TLPDF BOOL bStop = FALSE; - int nJobStartError = JOBSET_ERR_DEFAULT; +// TLPDF int nJobStartError = JOBSET_ERR_DEFAULT; XubString sJobName( rPrintData.GetJobName() ); -- cgit v1.2.3 From d9d92875a62f7c2142f4c851f10eccdf896cc4ee Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 28 Aug 2009 14:15:32 +0000 Subject: fix warning --- sw/source/core/view/vprint.cxx | 4 ++-- sw/source/ui/dbui/dbmgr.cxx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index b1f3c8e88eaf..24ea49b78eef 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1363,9 +1363,9 @@ sal_Bool ViewShell::PrintOrPDFExport( // TLPDF pShell->InitPrt( pOutDev, bIsPDFExport ? pOutDev : 0 ); pShell->InitPrt( pOutDev ); - ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ + ViewShell *pViewSh3 = nPage == 0 ? /* post-it page? */ rPrintData.GetRenderData().m_pPostItShell : pShell; - ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF + ::SetSwVisArea( pViewSh3, pStPage->Frm() ); // TLPDF // TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index ff29ca8638e2..034429f39ca7 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -458,7 +458,7 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) case DBMGR_MERGE_MAILMERGE: // Serienbrief { SwView& rView = rMergeDesc.rSh.GetView(); -#ifdef TL_NOT_NOW /*TLPDF*/ +#ifdef TL_NOT_NOW /*TLPDF*/ SfxDispatcher *pDis = rView.GetViewFrame()->GetDispatcher(); SfxItemSet aPrintArgs( rView.GetPool(), SID_SILENT, SID_SILENT, //5528 @@ -523,7 +523,7 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) } } -#endif //def TL_NOT_NOW /*TLPDF*/ +#endif //def TL_NOT_NOW /*TLPDF*/ // TLPDF pDis->Execute( SID_PRINTDOC, // TLPDF SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, @@ -540,8 +540,8 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) aVal >>= _bVal; aVal >>= _nVal; aVal >>= _sVal; - } -#endif + } +#endif // printing should be done synchronous otherwise the document // might already become invalid during the process @@ -550,8 +550,8 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) aOptions.realloc( nOpts + 1 ); aOptions[ nOpts ].Name = rtl::OUString::createFromAscii( "Wait" ); aOptions[ nOpts ].Value <<= sal_True ; - - const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); + + const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); if (pModOpt->IsSinglePrintJob()) { } @@ -925,8 +925,8 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, //TLPDF if( rOpt.IsPrintSingleJobs() ) //TLPDF pPrt->SetEndPrintHdl( Link() ); - BOOL bUserBreak = FALSE, - bRet = FALSE; +//TLPDF BOOL bUserBreak = FALSE; + BOOL bRet = FALSE; long nStartRow, nEndRow; //calculate number of data sets to be printed -- cgit v1.2.3 From 49722c743ab79cb01c4932c894549d8db9bb9426 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 31 Aug 2009 08:59:41 +0000 Subject: #i101242# minor clean-up --- sw/source/core/view/viewpg.cxx | 419 ++++++++++------------------------------- sw/source/core/view/vprint.cxx | 365 ++++++++--------------------------- sw/source/ui/dbui/dbmgr.cxx | 5 +- sw/source/ui/uno/unotxdoc.cxx | 3 +- 4 files changed, 183 insertions(+), 609 deletions(-) diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index c0b5987e0046..cc97ae5ef3ed 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -474,32 +474,23 @@ void ViewShell::PrintProspectMM( // OD 05.05.2003 #i14016# - consider empty pages on calculation of the scaling // for a page to be printed. void ViewShell::PrintProspect( - OutputDevice* pOutDev, - const SwPrintData & rPrintData, + OutputDevice *pOutDev, + const SwPrintData &rPrintData, sal_Int32 nRenderer // the index in the vector of prospect pages to be printed ) { -// TLPDF if( !rOptions.aMulti.GetSelectCount() ) + const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagePairsForProspectPrinting().size() - 1; +#if OSL_DEBUG_LEVEL > 1 + DBG_ASSERT( 0 <= nRenderer && nRenderer < nMaxRenderer, "nRenderer out of bounds"); +#endif Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); - if (!pPrinter || rPrintData.GetRenderData().GetPagePairsForProspectPrinting().size() <= 0) + if (!pPrinter || nMaxRenderer <= 0 || nRenderer < 0 || nRenderer > nMaxRenderer) return; -#ifdef TL_NOT_NOW /*TLPDF*/ - // wenn kein Drucker vorhanden ist, wird nicht gedruckt - SfxPrinter* pPrt = getIDocumentDeviceAccess()->getPrinter(false); - if( !pPrt || !pPrt->GetName().Len() || - ( !rOptions.bPrintLeftPage && !rOptions.bPrintRightPage )) - return; -#endif // TL_NOT_NOW /*TLPDF*/ - - // save settings of OutputDevice (should be done always now since the + // save settings of OutputDevice (should be done always since the // output device is now provided by a call from outside the Writer) pPrinter->Push(); -/* TLPDF neu: start */ -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetRenderData().GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); -#endif std::pair< sal_Int32, sal_Int32 > rPagesToPrint = rPrintData.GetRenderData().GetPagePairsForProspectPrinting()[ nRenderer ]; const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? @@ -508,27 +499,9 @@ void ViewShell::PrintProspect( DBG_ASSERT( rPagesToPrint.first == -1 || rPrintData.GetRenderData().GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); DBG_ASSERT( rPagesToPrint.second == -1 || rPrintData.GetRenderData().GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); #endif -/* TLPDF neu: end */ - -#ifdef TL_NOT_NOW /*TLPDF*/ - MultiSelection aMulti( rOptions.aMulti ); - Range aPages( aMulti.FirstSelected(), aMulti.LastSelected() ); - if ( aPages.Max() > USHRT_MAX ) - aPages.Max() = USHRT_MAX; - - ASSERT( aPages.Min() > 0, - "Seite 0 Drucken?" ); - ASSERT( aPages.Min() <= aPages.Max(), - "MinSeite groesser MaxSeite." ); -#endif // TL_NOT_NOW /*TLPDF*/ // eine neue Shell fuer den Printer erzeugen -// TLPDF ViewShell aShell( *this, 0 ); ViewShell aShell( *this, 0, pPrinter ); -#ifdef TL_NOT_NOW /*TLPDF*/ - if ( &GetRefDev() == pPrt ) - aShell.mpTmpRef = new SfxPrinter( *pPrt ); -#endif // TL_NOT_NOW /*TLPDF*/ SET_CURR_SHELL( &aShell ); @@ -552,315 +525,131 @@ void ViewShell::PrintProspect( // Seiten fuers Drucken formatieren aShell.CalcPagesForPrint( nPageMax, 0 /*(USHORT)aPages.Max(), &rProgress*/ ); -#ifdef TL_NOT_NOW /*TLPDF*/ - USHORT nCopyCnt = rOptions.bCollate ? rOptions.nCopyCount : 1; - - const SwPageFrm *pStPage = (SwPageFrm*)GetLayout()->Lower(); - USHORT i; + MapMode aMapMode( MAP_TWIP ); + Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ - for( i = 1; pStPage && i < (USHORT)aPages.Min(); ++i ) - pStPage = (SwPageFrm*)pStPage->GetNext(); -#endif // TL_NOT_NOW /*TLPDF*/ + SwTwips nMaxRowSz, nMaxColSz; -#ifdef TL_NOT_NOW /*TLPDF*/ - should not happen any more since the test - rPrintData.GetPagePairsForProspectPrinting().size() <= 0 - above should have taken care that there is at least one page to print - if( !pStPage ) // dann wars das + const SwPageFrm *pStPage = 0; + const SwPageFrm *pNxtPage = 0; + const SwRenderData::ValidStartFramesMap_t &rFrms = rPrintData.GetRenderData().GetValidStartFrames(); + if (rPagesToPrint.first > 0) { - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); - } - return; + SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + pStPage = aIt->second; } -#endif // TL_NOT_NOW /*TLPDF*/ - -#ifdef TL_NOT_NOW /*TLPDF*/ - // unsere SttPage haben wir, dann die EndPage suchen - SvPtrarr aArr( 255, 255 ); - aArr.Insert( (void*)pStPage, aArr.Count() ); - - while( pStPage->GetNext() && i < nPageMax (USHORT)aPages.Max() ) + if (rPagesToPrint.second > 0) { - pStPage = (SwPageFrm*)pStPage->GetNext(); - if( aMulti.IsSelected( ++i ) ) - aArr.Insert( (void*)pStPage, aArr.Count() ); + SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.second ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + pNxtPage = aIt->second; } - // auf Doppelseiten auffuellen - if( 1 == aArr.Count() ) // eine Seite ist ein Sonderfall - aArr.Insert( (void*)0, 1 ); - else + // OD 05.05.2003 #i14016# - consider empty pages on calculation + // of page size, used for calculation of scaling. + Size aSttPageSize; + if ( pStPage ) { - while( aArr.Count() & 3 ) - aArr.Insert( (void*)0, aArr.Count() ); - - if( rOptions.bPrintReverse && 4 < aArr.Count() ) + if ( pStPage->IsEmptyPage() ) { - // das Array umsortieren - // Array: 1 2 3 4 5 6 7 8 - // soll: 3 4 1 2 7 8 5 6 - // Algorhytmus: - // vordere Haelfte: Austausch von 2 Pointer von Vorne vor die Haelfte - // hintere Haelfte: Austausch von 2 Pointer von der Haelfte nach hinten - - USHORT nHalf = aArr.Count() / 2; - USHORT nSwapCount = nHalf / 4; - - VoidPtr* ppArrStt = (VoidPtr*)aArr.GetData(); - VoidPtr* ppArrHalf = (VoidPtr*)aArr.GetData() + nHalf; - - for( int nLoop = 0; nLoop < 2; ++nLoop ) - { - for( USHORT n = 0; n < nSwapCount; ++n ) - { - void* pTmp = *ppArrStt; - *ppArrStt++ = *(ppArrHalf-2); - *(ppArrHalf-2) = pTmp; - - pTmp = *ppArrStt; - *ppArrStt++ = *--ppArrHalf; - *ppArrHalf-- = pTmp; - } - ppArrStt = (VoidPtr*)aArr.GetData() + nHalf; - ppArrHalf = (VoidPtr*)aArr.GetData() + aArr.Count(); - } + if ( pStPage->GetPhyPageNum() % 2 == 0 ) + aSttPageSize = pStPage->GetPrev()->Frm().SSize(); + else + aSttPageSize = pStPage->GetNext()->Frm().SSize(); + } + else + { + aSttPageSize = pStPage->Frm().SSize(); } } -#endif // TL_NOT_NOW /*TLPDF*/ - -//TLPDF BOOL bStartJob = FALSE; - - for( USHORT nCnt = 0; nCnt <= 0 /*< 1 TLPDF nCopyCnt*/; nCnt++ ) + Size aNxtPageSize; + if ( pNxtPage ) { -#ifdef TL_NOT_NOW /*TLPDF*/ - if( rOptions.IsPrintSingleJobs() && rOptions.GetJobName().Len() && - ( bStartJob || rOptions.bJobStartet ) ) + if ( pNxtPage->IsEmptyPage() ) { - pPrt->EndJob(); - rOptions.bJobStartet = TRUE; - - // Reschedule statt Yield, da Yield keine Events abarbeitet - // und es sonst eine Endlosschleife gibt. - while( pPrt->IsPrinting() ) - rProgress.Reschedule(); - - rOptions.MakeNextJobName(); - DBG_ERROR( "StartJob does not exist anymore" ); - // bStartJob = pPrt->StartJob( rOptions.GetJobName() ); + if ( pNxtPage->GetPhyPageNum() % 2 == 0 ) + aNxtPageSize = pNxtPage->GetPrev()->Frm().SSize(); + else + aNxtPageSize = pNxtPage->GetNext()->Frm().SSize(); } - - // dann sorge mal dafuer, das alle Seiten in der richtigen - // Reihenfolge stehen: - USHORT nSPg = 0, nEPg = aArr.Count(), nStep = 1; - if( 0 == (nEPg & 1 )) // ungerade gibt es nicht! - --nEPg; - - if( !rOptions.bPrintLeftPage ) - ++nStep; - else if( !rOptions.bPrintRightPage ) + else { - ++nStep; - ++nSPg, --nEPg; + aNxtPageSize = pNxtPage->Frm().SSize(); } + } - USHORT nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1; -#endif // TL_NOT_NOW /*TLPDF*/ - - MapMode aOld( /*TLPDF pPrt*/pPrinter->GetMapMode() ); - MapMode aMapMode( MAP_TWIP ); -// TLPDF Size aPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode ) ); - Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ + if( !pStPage ) + { + nMaxColSz = 2 * aNxtPageSize.Width(); + nMaxRowSz = aNxtPageSize.Height(); + } + else if( !pNxtPage ) + { + nMaxColSz = 2 * aSttPageSize.Width(); + nMaxRowSz = aSttPageSize.Height(); + } + else + { + nMaxColSz = aNxtPageSize.Width() + aSttPageSize.Width(); + nMaxRowSz = Max( aNxtPageSize.Height(), aSttPageSize.Height() ); + } -#ifdef TL_NOT_NOW /*TLPDF*/ - const XubString aTmp( SW_RES( STR_STATSTR_PRINT ) ); - rProgress.SetText( aTmp ); - //HACK, damit die Anzeige nicht durcheinander kommt: - rProgress.SetState( 1, nCntPage ); - rProgress.SetText( aTmp ); -#endif // TL_NOT_NOW /*TLPDF*/ + // den MapMode einstellen + aMapMode.SetOrigin( Point() ); + { + Fraction aScX( aPrtSize.Width(), nMaxColSz ); + Fraction aScY( aPrtSize.Height(), nMaxRowSz ); + if( aScX < aScY ) + aScY = aScX; - for( USHORT nPrintCount = 0; nPrintCount <= 0 /*nSPg < nEPg && nPrintCount < nCntPage*/; ++nPrintCount ) { -#ifdef TL_NOT_NOW /*TLPDF*/ - // Mag der Anwender noch ? - rProgress.Reschedule(); - - if ( !pPrt->IsJobActive() ) - break; - - pStPage = (SwPageFrm*)aArr[ nSPg ]; - const SwPageFrm* pNxtPage = nEPg < aArr.Count() - ? (SwPageFrm*)aArr[ nEPg ] - : 0; -#endif // TL_NOT_NOW /*TLPDF*/ - - SwTwips nMaxRowSz, nMaxColSz; - -/* TLPDF neu: start */ - const SwPageFrm *pStPage = 0; - const SwPageFrm *pNxtPage = 0; - const SwRenderData::ValidStartFramesMap_t &rFrms = rPrintData.GetRenderData().GetValidStartFrames(); - if (rPagesToPrint.first > 0) - { - SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); - DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); - pStPage = aIt->second; - } - if (rPagesToPrint.second > 0) - { - SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.second ) ); - DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); - pNxtPage = aIt->second; - } -/* TLPDF neu: end */ - - // OD 05.05.2003 #i14016# - consider empty pages on calculation - // of page size, used for calculation of scaling. - Size aSttPageSize; - if ( pStPage ) - { - if ( pStPage->IsEmptyPage() ) - { - if ( pStPage->GetPhyPageNum() % 2 == 0 ) - aSttPageSize = pStPage->GetPrev()->Frm().SSize(); - else - aSttPageSize = pStPage->GetNext()->Frm().SSize(); - } - else - { - aSttPageSize = pStPage->Frm().SSize(); - } - } - Size aNxtPageSize; - if ( pNxtPage ) - { - if ( pNxtPage->IsEmptyPage() ) - { - if ( pNxtPage->GetPhyPageNum() % 2 == 0 ) - aNxtPageSize = pNxtPage->GetPrev()->Frm().SSize(); - else - aNxtPageSize = pNxtPage->GetNext()->Frm().SSize(); - } - else - { - aNxtPageSize = pNxtPage->Frm().SSize(); - } - } - - if( !pStPage ) - { - nMaxColSz = 2 * aNxtPageSize.Width(); - nMaxRowSz = aNxtPageSize.Height(); - } - else if( !pNxtPage ) - { - nMaxColSz = 2 * aSttPageSize.Width(); - nMaxRowSz = aSttPageSize.Height(); - } + // fuer Drawing, damit diese ihre Objecte vernuenftig Painten + // koennen, auf "glatte" Prozentwerte setzen + aScY *= Fraction( 1000, 1 ); + long nTmp = (long)aScY; + if( 1 < nTmp ) + --nTmp; else - { - nMaxColSz = aNxtPageSize.Width() + - aSttPageSize.Width(); - nMaxRowSz = Max( aNxtPageSize.Height(), - aSttPageSize.Height() ); - } - -#ifdef TL_NOT_NOW /*TLPDF*/ - short nRtlOfs = bRTL ? 1 : 0; - if( 0 == (( nSPg + nRtlOfs) & 1 ) ) // switch for odd number in LTR, even number in RTL - { - const SwPageFrm* pTmp = pStPage; - pStPage = pNxtPage; - pNxtPage = pTmp; - } -#endif // TL_NOT_NOW /*TLPDF*/ - - // den MapMode einstellen - aMapMode.SetOrigin( Point() ); - { - Fraction aScX( aPrtSize.Width(), nMaxColSz ); - Fraction aScY( aPrtSize.Height(), nMaxRowSz ); - if( aScX < aScY ) - aScY = aScX; - - { - // fuer Drawing, damit diese ihre Objecte vernuenftig Painten - // koennen, auf "glatte" Prozentwerte setzen - aScY *= Fraction( 1000, 1 ); - long nTmp = (long)aScY; - if( 1 < nTmp ) - --nTmp; - else - nTmp = 1; - aScY = Fraction( nTmp, 1000 ); - } - - aMapMode.SetScaleY( aScY ); - aMapMode.SetScaleX( aScY ); - } - -// TLPDF Point aPrtOff( pPrt->PixelToLogic( pPrt->GetPageOffsetPixel(), aMapMode ) ); -// TLPDF Size aTmpPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode ) ); -// TLPDF Point aPrtOff( pPrinter->PixelToLogic( pPrinter->GetPageOffsetPixel(), aMapMode ) ); /* TLPDF */ - Size aTmpPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ + nTmp = 1; + aScY = Fraction( nTmp, 1000 ); + } - // dann kann das drucken losgehen -//TLPDF bStartJob = TRUE; -//TLPDF rProgress.SetState( nPrintCount, nCntPage ); + aMapMode.SetScaleY( aScY ); + aMapMode.SetScaleX( aScY ); + } -#ifdef TL_NOT_NOW /*TLPDF*/ - pPrt->StartPage(); -#endif + Size aTmpPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ - // calculate start point for equal border on all sides - Point aSttPt( (aTmpPrtSize.Width() - nMaxColSz) / 2, - (aTmpPrtSize.Height() - nMaxRowSz) / 2 ); - for( int nC = 0; nC < 2; ++nC ) - { - if( pStPage ) - { - aShell.Imp()->SetFirstVisPageInvalid(); - aShell.aVisArea = pStPage->Frm(); + // calculate start point for equal border on all sides + Point aSttPt( (aTmpPrtSize.Width() - nMaxColSz) / 2, + (aTmpPrtSize.Height() - nMaxRowSz) / 2 ); + for( int nC = 0; nC < 2; ++nC ) + { + if( pStPage ) + { + aShell.Imp()->SetFirstVisPageInvalid(); + aShell.aVisArea = pStPage->Frm(); - Point aPos( aSttPt ); - aPos -= aShell.aVisArea.Pos(); + Point aPos( aSttPt ); + aPos -= aShell.aVisArea.Pos(); // TLPDF aPos -= aPrtOff; - aMapMode.SetOrigin( aPos ); - pPrinter->SetMapMode( aMapMode ); - pStPage->GetUpper()->Paint( pStPage->Frm() ); - } - - pStPage = pNxtPage; - aSttPt.X() += aTmpPrtSize.Width() / 2; - } - -#ifdef TL_NOT_NOW /*TLPDF*/ - pPrt->EndPage(); -#endif - SwPaintQueue::Repaint(); - -#ifdef TL_NOT_NOW /*TLPDF*/ - nSPg = nSPg + nStep; - nEPg = nEPg - nStep; -#endif // TL_NOT_NOW /*TLPDF*/ + aMapMode.SetOrigin( aPos ); + pPrinter->SetMapMode( aMapMode ); + pStPage->GetUpper()->Paint( pStPage->Frm() ); } - pPrinter->SetMapMode( aOld ); - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); - } + pStPage = pNxtPage; + aSttPt.X() += aTmpPrtSize.Width() / 2; + } -#ifdef TL_NOT_NOW /*TLPDF*/ - if( bStartJob ) - rOptions.bJobStartet = TRUE; -#endif // TL_NOT_NOW /*TLPDF*/ + SwPaintQueue::Repaint(); + + if( bHiddenFlds ) + { + SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); + pFldType->Modify( &aHnt, 0); + CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); } pFntCache->Flush(); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 24ea49b78eef..1e399b2ee3f7 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1070,8 +1070,8 @@ sal_Bool ViewShell::PrintOrPDFExportMM( sal_Bool ViewShell::PrintOrPDFExport( - OutputDevice* pOutDev, - const SwPrtOptions &rPrintData, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ + OutputDevice *pOutDev, + const SwPrtOptions &rPrintData, sal_Int32 nRenderer, // the index in the vector of pages to be printed bool bIsPDFExport ) { @@ -1079,37 +1079,17 @@ sal_Bool ViewShell::PrintOrPDFExport( //Immer die Druckroutinen in viewpg.cxx (PrintPreViewPage und PrintProspect) mitpflegen!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - BOOL bStartJob = FALSE; - //! Note: Since for PDF export of (multi-)selection a temporary - //! document is created that contains only the selects parts, - //! and thus that document is to printed in whole the, - //! rPrintData.bPrintSelection parameter will be false. - BOOL bSelection = rPrintData.bPrintSelection; - -// TLPDF: this one should hold just one page now. Thus clean-up should be possible - MultiSelection aMulti( rPrintData.aMulti ); - - if ( !pOutDev || !aMulti.GetSelectCount() ) - return bStartJob; + const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagesToPrint().size() - 1; +#if OSL_DEBUG_LEVEL > 1 + DBG_ASSERT( 0 <= nRenderer && nRenderer < nMaxRenderer, "nRenderer out of bounds"); +#endif + if (!pOutDev || nMaxRenderer <= 0 || nRenderer < 0 || nRenderer > nMaxRenderer) + return sal_False; - // save settings of OutputDevice (should be done always now since the + // save settings of OutputDevice (should be done always since the // output device is now provided by a call from outside the Writer) pOutDev->Push(); - Range aPages( aMulti.FirstSelected(), aMulti.LastSelected() ); - if ( aPages.Max() > USHRT_MAX ) - aPages.Max() = USHRT_MAX; - - ASSERT( aPages.Min() > 0, - "Seite 0 Drucken?" ); - ASSERT( aPages.Min() <= aPages.Max(), - "MinSeite groesser MaxSeite." ); - -// TLPDF - ASSERT( aPages.Min() == aPages.Max(), "Min page should be equal to Max page now" ); /* TLPDF */ -// TLPDF TODO: clean-up aPage.Min/Max which should be identical now - - // Einstellungen am Drucker merken // SwPrtOptSave aPrtSave( pOutDev ); /* TLPDF wo dann heutzutage ??? */ @@ -1121,6 +1101,12 @@ sal_Bool ViewShell::PrintOrPDFExport( //!! (h?ngt mit OLE Objekten im Dokument zusammen.) SfxObjectShellRef aDocShellRef; + //! Note: Since for PDF export of (multi-)selection a temporary + //! document is created that contains only the selects parts, + //! and thus that document is to printed in whole the, + //! rPrintData.bPrintSelection parameter will be false. + BOOL bSelection = rPrintData.bPrintSelection; + // PDF export for (multi-)selection has already generated a temporary document // with the selected text. (see XRenderable implementation in unotxdoc.cxx) // Thus we like to go in the 'else' part here in that case. @@ -1132,18 +1118,15 @@ sal_Bool ViewShell::PrintOrPDFExport( pOutDevDoc = CreatePrtDoc( /*TLPDF pOutDev,*/ aDocShellRef ); // eine ViewShell darauf -// TLPDF OutputDevice *pTmpDev = bIsPDFExport ? pOutDev : 0; -// TLPDF pShell = new ViewShell( *pOutDevDoc, 0, pOpt, pTmpDev ); pShell = new ViewShell( *pOutDevDoc, 0, pOpt, pOutDev ); pOutDevDoc->SetRefForDocShell( 0 ); } else { pOutDevDoc = GetDoc(); -// TLPDF OutputDevice *pTmpDev = bIsPDFExport ? pOutDev : 0; -// TLPDF pShell = new ViewShell( *this, 0, pTmpDev ); pShell = new ViewShell( *this, 0, pOutDev ); } + SdrView *pDrawView = pShell->GetDrawView(); if (pDrawView) { @@ -1154,281 +1137,81 @@ sal_Bool ViewShell::PrintOrPDFExport( { //Zusaetzlicher Scope, damit die CurrShell vor dem zerstoeren der //Shell zurueckgesetzt wird. - SET_CURR_SHELL( pShell ); - - //JP 01.02.99: das ReadOnly Flag wird NIE mitkopiert; Bug 61335 - if( pOpt->IsReadonly() ) - pShell->pOpt->SetReadonly( TRUE ); + SET_CURR_SHELL( pShell ); - // save options at draw view: - SwDrawViewSave aDrawViewSave( pShell->GetDrawView() ); + //JP 01.02.99: das ReadOnly Flag wird NIE mitkopiert; Bug 61335 + if( pOpt->IsReadonly() ) + pShell->pOpt->SetReadonly( TRUE ); - pShell->PrepareForPrint( rPrintData ); + // save options at draw view: + SwDrawViewSave aDrawViewSave( pShell->GetDrawView() ); - XubString* pStr = 0; -//TLPDF ULONG nMergeAct = rPrintData.nMergeAct, nMergeCnt = rPrintData.nMergeCnt; + pShell->PrepareForPrint( rPrintData ); - -/* TLPDF neu: start */ + const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetRenderData().GetPagesToPrint().size(), "nRenderer out of bounds"); -#endif - const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( nPage == 0 || rPrintData.GetRenderData().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); -#endif - const SwPageFrm *pStPage = 0; - if (nPage > 0) // a 'regular' page, not one from the post-it document - { - const SwRenderData::ValidStartFramesMap_t &rFrms = rPrintData.GetRenderData().GetValidStartFrames(); - SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); - DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); - if (aIt == rFrms.end()) - return sal_False; - pStPage = aIt->second; - } - else // a page from the post-its document ... - { - DBG_ASSERT( nPage == 0, "unexpected page number. 0 for post-it pages expected" ); - pStPage = rPrintData.GetRenderData().GetPostItStartFrames()[ nRenderer ]; - } - DBG_ASSERT( pStPage, "failed to get start page" ); -/* TLPDF neu: end */ - - - // benoetigte Seiten fuers Drucken formatieren - pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, pStr, - 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); - - // Some field types, can require a valid layout - // (expression fields in tables). For these we do an UpdateFlds - // here after calculation of the pages. - // --> FME 2004-06-21 #i9684# For performance reasons, we do not update - // the fields during pdf export. - // #i56195# prevent update of fields (for mail merge) - if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) - // <-- - pShell->UpdateFlds(TRUE); - -// TLPDF if( !pShell->Imp()->IsStopOutDev() && -// TLPDF ( bIsPDFExport || rPrintData.GetJobName().Len() || pOutDev->IsJobActive()) ) - if( /*!pShell->Imp()->IsStopOutDev() && */ - ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) - { -// TLPDF BOOL bStop = FALSE; -// TLPDF int nJobStartError = JOBSET_ERR_DEFAULT; - - XubString sJobName( rPrintData.GetJobName() ); - -// HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit -// geschaffen werden, alle Seiten von Seite x an zu deselektieren. -// Z.B. durch SetTotalRange .... - -// aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), FALSE ); -// TLPDF MultiSelection aTmpMulti( Range( 1, nLastPageNo ) ); - MultiSelection aTmpMulti( Range( 1, nPage ) ); - long nTmpIdx = aMulti.FirstSelected(); - static long nEndOfSelection = SFX_ENDOFSELECTION; -// TLPDF while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nLastPageNo) ) - while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nPage) ) - { - aTmpMulti.Select( nTmpIdx ); - nTmpIdx = aMulti.NextSelected(); - } - aMulti = aTmpMulti; -// Ende des HACKs - -#if 0 - const USHORT nSelCount = USHORT(aMulti.GetSelectCount() - /* * nCopyCnt*/); -#endif - - // PostitListe holen - _SetGetExpFlds aPostItFields; -// TLPDF SwDoc* pPostItDoc = 0; -// TLPDF ViewShell* pPostItShell = 0; -#ifdef TL_NOT_NOW /*TLPDF*/ - if( rPrintData.nPrintPostIts != POSTITS_NONE ) - { - lcl_GetPostIts( pDoc, aPostItFields ); - pPostItDoc = new SwDoc; -/* TLPDF - if (pOutDev) - pPostItDoc->setPrinter( pOutDev, true, true ); -*/ - pPostItShell = new ViewShell( *pPostItDoc, 0, - pShell->GetViewOptions() ); - // Wenn PostIts am Dokumentenende gedruckt werden sollen, - // die Druckreihenfolge allerdings umgekehrt ist, dann hier - if ( ( rPrintData.nPrintPostIts == POSTITS_ENDDOC ) && - rPrintData.bPrintReverse ) - lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, - aMulti, sJobName, bStartJob, nJobStartError, - rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, TRUE ); - - } -#endif // TL_NOT_NOW /*TLPDF*/ - - // aOldMapMode wird fuer das Drucken von Umschlaegen gebraucht. - MapMode aOldMapMode; - - const SwPageDesc *pLastPageDesc = NULL; - // BOOL bSetOrient = FALSE; - // BOOL bSetPaperSz = FALSE; - BOOL bSetPrt = FALSE; - -//TLPDF if ( rPrintData.nPrintPostIts != POSTITS_ONLY ) - { -//TLPDF while( pStPage && !bStop ) - { - ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ - rPrintData.GetRenderData().m_pPostItShell : pShell; - ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF - - // wenn wir einen Umschlag drucken wird ein Offset beachtet - if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) - { - aOldMapMode = pOutDev->GetMapMode(); - Point aNewOrigin = pOutDev->GetMapMode().GetOrigin(); - aNewOrigin += rPrintData.aOffset; - MapMode aTmp( pOutDev->GetMapMode() ); - aTmp.SetOrigin( aNewOrigin ); - pOutDev->SetMapMode( aTmp ); - } - - { - if ( bSetPrt ) - { - // check for empty page - const SwPageFrm& rFormatPage = pStPage->GetFormatPage(); - - if ( pLastPageDesc != rFormatPage.GetPageDesc() ) - { - pLastPageDesc = rFormatPage.GetPageDesc(); -#if 0 // TL_PDF - const BOOL bLandScp = rFormatPage.GetPageDesc()->GetLandscape(); - - if( bSetPaperBin ) // Schacht einstellen. - pPrt->SetPaperBin( rFormatPage.GetFmt()-> - GetPaperBin().GetValue() ); - - if (bSetOrient ) - { - // Orientation einstellen: Breiter als Hoch - // -> Landscape, sonst -> Portrait. - if( bLandScp ) - pPrt->SetOrientation(ORIENTATION_LANDSCAPE); - else - pPrt->SetOrientation(ORIENTATION_PORTRAIT); - } - - if (bSetPaperSz ) - { - Size aSize = pStPage->Frm().SSize(); - if ( bLandScp && bSetOrient ) - { - // landscape is always interpreted as a rotation by 90 degrees ! - // this leads to non WYSIWIG but at least it prints! - // #i21775# - long nWidth = aSize.Width(); - aSize.Width() = aSize.Height(); - aSize.Height() = nWidth; - } - Paper ePaper = SvxPaperInfo::GetSvxPaper(aSize,MAP_TWIP,TRUE); - if ( PAPER_USER == ePaper ) - pPrt->SetPaperSizeUser( aSize ); - else - pPrt->SetPaper( ePaper ); - } + DBG_ASSERT( nPage == 0 || rPrintData.GetRenderData().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif - } - } - -#ifdef TL_NOT_NOW /*TLPDF*/ - // Wenn PostIts nach Seite gedruckt werden sollen, - // jedoch Reverse eingestellt ist ... - if( rPrintData.bPrintReverse && - rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) - lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, - nPage /* TLPDF nPageNo*/, aMulti, sJobName, bStartJob, nJobStartError, - rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, - rPrintData.bPrintReverse ); -#endif // TL_NOT_NOW /*TLPDF*/ - - -// TLPDF if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError -// TLPDF && sJobName.Len() ) - { - -// TLPDF pShell->InitPrt( pOutDev, bIsPDFExport ? pOutDev : 0 ); - pShell->InitPrt( pOutDev ); - - ViewShell *pViewSh3 = nPage == 0 ? /* post-it page? */ - rPrintData.GetRenderData().m_pPostItShell : pShell; - ::SetSwVisArea( pViewSh3, pStPage->Frm() ); // TLPDF -// TLPDF nJobStartError = JOBSET_ERR_ISSTARTET; - } - // --> FME 2005-12-12 #b6354161# Feature - Print empty pages -// TLPDF if ( rPrintData.bPrintEmptyPages || pStPage->Frm().Height() ) - // <-- - { - pStPage->GetUpper()->Paint( pStPage->Frm() ); - } - SwPaintQueue::Repaint(); - -#ifdef TL_NOT_NOW /*TLPDF*/ - // Wenn PostIts nach Seite gedruckt werden sollen ... - if( (!rPrintData.bPrintReverse) && - rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) - lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, - nPage /* TLPDF nPageNo */, aMulti, sJobName, bStartJob, nJobStartError, - rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, - rPrintData.bPrintReverse ); -#endif // TL_NOT_NOW /*TLPDF*/ - } + const SwPageFrm *pStPage = 0; + if (nPage > 0) // a 'regular' page, not one from the post-it document + { + const SwRenderData::ValidStartFramesMap_t &rFrms = rPrintData.GetRenderData().GetValidStartFrames(); + SwRenderData::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); + DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); + if (aIt == rFrms.end()) + return sal_False; + pStPage = aIt->second; + } + else // a page from the post-its document ... + { + DBG_ASSERT( nPage == 0, "unexpected page number. 0 for post-it pages expected" ); + pStPage = rPrintData.GetRenderData().GetPostItStartFrames()[ nRenderer ]; + } + DBG_ASSERT( pStPage, "failed to get start page" ); + + // benoetigte Seiten fuers Drucken formatieren + pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, 0 /*TLPDFpStr*/, + 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); + + // Some field types, can require a valid layout + // (expression fields in tables). For these we do an UpdateFlds + // here after calculation of the pages. + // --> FME 2004-06-21 #i9684# For performance reasons, we do not update + // the fields during pdf export. + // #i56195# prevent update of fields (for mail merge) + if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) + pShell->UpdateFlds(TRUE); + // <-- - // den eventl. fuer Umschlaege modifizierte OutDevOffset wieder - // zuruecksetzen. - if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) - pOutDev->SetMapMode( aOldMapMode ); + ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ + rPrintData.GetRenderData().m_pPostItShell : pShell; + ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF - } // TLPDF loop end: while( pStPage && !bStop ) - } + // wenn wir einen Umschlag drucken wird ein Offset beachtet + if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) + { + Point aNewOrigin = pOutDev->GetMapMode().GetOrigin(); + aNewOrigin += rPrintData.aOffset; + MapMode aTmp( pOutDev->GetMapMode() ); + aTmp.SetOrigin( aNewOrigin ); + pOutDev->SetMapMode( aTmp ); + } -#ifdef TL_NOT_NOW /*TLPDF*/ - if (!bStop) // TLPDF: see break above - { - // Wenn PostIts am Dokumentenende gedruckt werden sollen, dann hier machen - if( ((rPrintData.nPrintPostIts == POSTITS_ENDDOC) && !rPrintData.bPrintReverse) - || (rPrintData.nPrintPostIts == POSTITS_ONLY) ) - lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, - sJobName, bStartJob, nJobStartError, - rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, - rPrintData.bPrintReverse ); - - if( pPostItShell ) - { - pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt - delete pPostItShell; //Nimmt das PostItDoc mit ins Grab. - } + pShell->InitPrt( pOutDev ); -//TLPDF if( bStartJob ) -//TLPDF rPrintData.bJobStartet = TRUE; - } // TLPDF: if (!bStop) see break above -#endif // TL_NOT_NOW /*TLPDF*/ + pViewSh2 = nPage == 0 ? /* post-it page? */ + rPrintData.GetRenderData().m_pPostItShell : pShell; + ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF - } - delete pStr; + pStPage->GetUpper()->Paint( pStPage->Frm() ); + SwPaintQueue::Repaint(); } //Zus. Scope wg. CurShell! delete pShell; if (bSelection ) { - // damit das Dokument nicht den Drucker mit ins Grab nimmt -// pOutDevDoc->setPrinter( 0, false, false ); /*TLPDF should not be needed anymore*/ - if ( !pOutDevDoc->release() ) delete pOutDevDoc; } @@ -1437,7 +1220,7 @@ sal_Bool ViewShell::PrintOrPDFExport( // output device is now provided by a call from outside the Writer) pOutDev->Pop(); - return bStartJob; + return sal_True; } /****************************************************************************** diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 034429f39ca7..8ca8463a379a 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -552,12 +552,13 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) aOptions[ nOpts ].Value <<= sal_True ; const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); - if (pModOpt->IsSinglePrintJob()) + if (pModOpt->IsSinglePrintJob()) // single print job per document? { + rView.ExecPrint( aOptions, sal_False, sal_False ); } else { - rView.ExecPrint( aOptions, sal_False, sal_False ); + // here use the print adaptor top get just one print job } } break; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 46696961dca4..eafa1127afe5 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2753,7 +2753,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); // prospect printing should be landscape, thus switching width and height - if (m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False )) + if (m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False ) && + aPageSize.Height > aPageSize.Width) aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); uno::Sequence< beans::PropertyValue > aRenderer(2); aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); -- cgit v1.2.3 From 0d2b77c567c563b19ae4ed32a31d927282860129 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 1 Sep 2009 07:59:10 +0000 Subject: #i101242# DoPrint removed --- sw/source/ui/inc/view.hxx | 4 +- sw/source/ui/uiview/viewprt.cxx | 276 ---------------------------------------- 2 files changed, 1 insertion(+), 279 deletions(-) diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 0fb458573a61..92788e714c4f 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -424,8 +424,6 @@ public: virtual USHORT SetPrinter( SfxPrinter* pNew, USHORT nDiff = SFX_PRINTER_ALL, bool bIsAPI=false); - virtual ErrCode DoPrint( SfxPrinter *pPrinter, PrintDialog *pPrintDialog, - BOOL bSilent, BOOL bIsAPI ); ShellModes GetShellMode(); com::sun::star::view::XSelectionSupplier* GetUNOObject(); @@ -691,4 +689,4 @@ SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions, BOOL bPreview); -#endif +#endif \ No newline at end of file diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 4a7e6477aa7f..54c00ea8313e 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -172,281 +172,6 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) return 0; } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, BOOL bIsAPI ) -{ - // First test - SwWrtShell* pSh = &GetWrtShell(); - SwNewDBMgr* pMgr = pSh->GetNewDBMgr(); - - int bPrintSelection = -1; - USHORT nMergeType = pMgr->GetMergeType(); - if( DBMGR_MERGE_MAILMERGE != nMergeType && - DBMGR_MERGE_DOCUMENTS != nMergeType && - !pDlg && - !bIsAPI && ( pSh->IsSelection() || pSh->IsFrmSelected() || - pSh->IsObjSelected() ) ) - { - short nBtn = SvxPrtQryBox(&GetEditWin()).Execute(); - if( RET_CANCEL == nBtn ) - return ERRCODE_IO_ABORT; - - if( RET_OK == nBtn ) - bPrintSelection = 1; - else - bPrintSelection = 0; - } - -// Der PrintProgress stellt Handler am Printer der ViewShell ein. -// Das kann natuerlich erst nach dem evtl. Umschalten des Druckers korrekt -// funktionieren. #55210# -// SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); - /* TLPDF SfxPrintProgress */ SfxProgress *pProgress = 0; - SfxPrinter *pDocPrinter = GetPrinter(TRUE); - if ( !pPrinter ) - pPrinter = pDocPrinter; - else if ( pDocPrinter != pPrinter ) - { - //Da der Doc-Drucker beim SetPrinter geloescht wird, - // muss man ihn vorher clonen -//TLPDF SfxPrinter* pClone = pDocPrinter->Clone(); -//TLPDF SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); -//TLPDF pProgress = new SfxPrintProgress( this, !bSilent ); -//TLPDF pProgress->RestoreOnEndPrint( pClone ); - } - if(!pProgress) -//TLPDF pProgress = new SfxPrintProgress( this, !bSilent ); - { - SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell(); // TLPDF ?? - pProgress = new SfxProgress( pObjShell, String(), 1 ); // TLPDF ?? - } - pProgress->SetWaitMode(FALSE); - - BOOL bStartJob = pPrinter->InitJob( &GetEditWin(), - !bIsAPI && pSh->HasDrawView() && pSh->GetDrawView()->GetModel()->HasTransparentObjects()); - if( bStartJob ) - { - // Drucker starten - PreparePrint( pDlg ); - SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell(); - //#i82625# GetTitle( 0 ) doesn't work for 'embedded' documents like forms or reports - String sDocumentTitle( pObjShell->GetTitle(SFX_TITLE_APINAME)); - SwPrtOptions aOpts( sDocumentTitle ); - BOOL bWeb = 0 != PTR_CAST(SwWebView, this); - nMergeType = pMgr->GetMergeType(); - - BOOL bPrtPros; - BOOL bPrtPros_RTL; - SwView::MakeOptions( pDlg, aOpts, &bPrtPros, &bPrtPros_RTL, bWeb, GetPrinter(), - pSh->getIDocumentDeviceAccess()->getPrintData() ); - - //set the appropriate view options to print - //on silent mode the field commands have to be switched off always - //on default print the user is asked what to do - const SwViewOption* pCurrentViewOptions = pSh->GetViewOptions(); - bool bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && pSh->IsAnyFieldInDoc(); - - if(!bSilent && bSwitchOff_IsFldName) - { - QueryBox aBox( &GetEditWin(), SW_RES( DLG_PRT_FIELDNAME ) ); - USHORT nRet = aBox.Execute(); - if( RET_CANCEL == nRet) - return ERRCODE_IO_ABORT; - // disable field commands - if( RET_NO != nRet ) - { - bSwitchOff_IsFldName = false; - } - } - bool bApplyViewOptions = bSwitchOff_IsFldName; - //switch off display of hidden characters if on and hidden characters are in use - const sal_Bool bOldShowHiddenChar = pCurrentViewOptions->IsShowHiddenChar(); - const sal_Bool bOldMetaChars = pCurrentViewOptions->IsViewMetaChars(); - if( bOldShowHiddenChar != aOpts.IsPrintHiddenText() - && pSh->GetDoc()->ContainsHiddenChars()) - bApplyViewOptions |= true; - //switch off display of hidden paragraphs if on and hidden paragraphs are in use - const sal_Bool bOldShowHiddenPara = pCurrentViewOptions->IsShowHiddenPara(); - if( aOpts.IsPrintHiddenText() != bOldShowHiddenPara ) - { - const SwFieldType* pFldType = pSh->GetDoc()->GetSysFldType(RES_HIDDENPARAFLD); - if( pFldType && pFldType->GetDepends()) - bApplyViewOptions |= true; - } - const sal_Bool bOldShowHiddenField = pCurrentViewOptions->IsShowHiddenField(); - if( aOpts.IsPrintHiddenText() != bOldShowHiddenField ) - { - const SwFieldType* pFldType = pSh->GetDoc()->GetSysFldType(RES_HIDDENTXTFLD); - if( pFldType || pFldType->GetDepends()) - bApplyViewOptions |= true; - } - - SwViewOption* pOrgViewOption = 0; - bApplyViewOptions |= !aOpts.IsPrintTextPlaceholder(); - if(bApplyViewOptions) - { - pOrgViewOption = new SwViewOption(*pSh->GetViewOptions()); - if(bSwitchOff_IsFldName) - pOrgViewOption->SetFldName(aOpts.IsPrintHiddenText()); - - pOrgViewOption->SetShowHiddenChar(aOpts.IsPrintHiddenText()); - pOrgViewOption->SetViewMetaChars(sal_True); - pOrgViewOption->SetShowHiddenPara(aOpts.IsPrintHiddenText()); - pOrgViewOption->SetShowHiddenField(aOpts.IsPrintHiddenText()); - pOrgViewOption->SetShowPlaceHolderFields( aOpts.bPrintTextPlaceholder ); - - SW_MOD()->ApplyUsrPref(*pOrgViewOption, this, VIEWOPT_DEST_VIEW_ONLY ); - } - - if( nMergeType == DBMGR_MERGE_MAILMERGE || - DBMGR_MERGE_DOCUMENTS == nMergeType ) - { - if(DBMGR_MERGE_DOCUMENTS == nMergeType) - bStartJob = pMgr->MergePrintDocuments( *this, aOpts, *pProgress, bIsAPI ); - else - bStartJob = pMgr->MergePrint( *this, aOpts, *pProgress, bIsAPI ); - } - else - { - const BOOL bLockedView = pSh->IsViewLocked(); - pSh->LockView( TRUE ); - - //BrowseView abschalten und die View gegen alle Paints locken. - BOOL bBrowse = pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE); - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - SfxBoolItem aBrowse( SID_BROWSER_MODE, FALSE ); - if ( bBrowse ) - { - if ( pSh->GetWin() ) - pSh->GetWin()->Update(); - pSh->LockPaint(); - aSet.Put( aBrowse, aBrowse.Which() ); - SfxRequest aReq( SID_BROWSER_MODE, 0, aSet ); - GetDocShell()->Execute( aReq ); - } - - // die Felder aktualisieren - BOOL bIsModified = pSh->IsModified(); - pSh->StartAllAction(); - SwDocStat aDocStat; - pSh->UpdateDocStat( aDocStat ); - pSh->EndAllTblBoxEdit(); - pSh->ViewShell::UpdateFlds(TRUE); - if( pSh->IsCrsrInTbl() ) - { - pSh->ClearTblBoxCntnt(); - pSh->SaveTblBoxCntnt(); - } - pSh->EndAllAction(); - - if( !bIsModified ) - pSh->ResetModified(); - - if( -1 != bPrintSelection ) - aOpts.bPrintSelection = 0 != bPrintSelection; - - uno::Sequence< beans::PropertyValue> aViewProperties(18); - beans::PropertyValue* pViewProperties = aViewProperties.getArray(); - pViewProperties[1].Name = C2U("PrintGraphics"); - pViewProperties[1].Value <<= (sal_Bool)aOpts.IsPrintGraphic(); - pViewProperties[2].Name = C2U("PrintTables"); - pViewProperties[2].Value <<= (sal_Bool)aOpts.IsPrintTable(); - pViewProperties[3].Name = C2U("PrintDrawings"); - pViewProperties[3].Value <<= (sal_Bool)aOpts.IsPrintDraw(); - pViewProperties[4].Name = C2U("PrintLeftPages"); - pViewProperties[4].Value <<= (sal_Bool)aOpts.IsPrintLeftPage(); - pViewProperties[5].Name = C2U("PrintRightPages"); - pViewProperties[5].Value <<= (sal_Bool)aOpts.IsPrintRightPage(); - pViewProperties[6].Name = C2U("PrintControls"); - pViewProperties[6].Value <<= (sal_Bool)aOpts.IsPrintControl(); - pViewProperties[7].Name = C2U("PrintReversed"); - pViewProperties[7].Value <<= (sal_Bool)aOpts.IsPrintReverse(); - pViewProperties[8].Name = C2U("PrintPaperFromSetup"); - pViewProperties[8].Value <<= (sal_Bool)aOpts.IsPaperFromSetup(); - pViewProperties[9].Name = C2U("PrintFaxName"); - pViewProperties[9].Value <<= aOpts.GetFaxName(); - pViewProperties[10].Name = C2U("PrintAnnotationMode"); - pViewProperties[10].Value <<= (text::NotePrintMode) aOpts.GetPrintPostIts(); - pViewProperties[11].Name = C2U("PrintProspect"); - pViewProperties[11].Value <<= (sal_Bool)aOpts.IsPrintProspect(); - pViewProperties[12].Name = C2U("PrintPageBackground"); - pViewProperties[12].Value <<= (sal_Bool)aOpts.IsPrintPageBackground(); - pViewProperties[13].Name = C2U("PrintBlackFonts"); - pViewProperties[13].Value <<= (sal_Bool)aOpts.IsPrintBlackFont(); - pViewProperties[0].Name = C2U("IsSinglePrintJob"); - pViewProperties[0].Value <<= (sal_Bool)aOpts.IsPrintSingleJobs(); - pViewProperties[14].Name = C2U("Selection"); - pViewProperties[14].Value <<= (sal_Bool)aOpts.bPrintSelection; - pViewProperties[15].Name = C2U("PrintEmptyPages"); - pViewProperties[15].Value <<= (sal_Bool)aOpts.bPrintEmptyPages; - pViewProperties[16].Name = C2U("PrintHiddenText"); - pViewProperties[16].Value <<= (sal_Bool)aOpts.bPrintHiddenText; - pViewProperties[17].Name = C2U("PrintTextPlaceholder"); - pViewProperties[17].Value <<= (sal_Bool)aOpts.bPrintTextPlaceholder; - SetAdditionalPrintOptions(aViewProperties); - - SfxViewShell::Print(*pProgress, bIsAPI ); -//TLPDF if ( !pProgress->IsAborted() ) - { - const boost::shared_ptr< Printer > pPrt( pPrinter ); // TLPDF - vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF - - if( bPrtPros ) - { -//TLPDF bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); -//TLPDF if( bStartJob ) - pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, aOpts, bPrtPros_RTL ); /* TLPDF */ - } - else - bStartJob = pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, aOpts ); /*TLPDF*/ - - if ( bBrowse ) - { - aBrowse.SetValue( TRUE ); - aSet.Put( aBrowse, aBrowse.Which() ); - SfxRequest aReq( SID_BROWSER_MODE, 0, aSet ); - GetDocShell()->Execute( aReq ); - pSh->UnlockPaint(); - } - } -//TLPDF else -//TLPDF bStartJob = FALSE; - - pSh->LockView( bLockedView ); - } - if(pOrgViewOption) - { - if(bSwitchOff_IsFldName) - pOrgViewOption->SetFldName(TRUE); - pOrgViewOption->SetShowHiddenChar(bOldShowHiddenChar); - pOrgViewOption->SetViewMetaChars(bOldMetaChars); - pOrgViewOption->SetShowHiddenField(bOldShowHiddenField); - pOrgViewOption->SetShowHiddenPara(bOldShowHiddenPara); - //must to be set to sal_True anyway - pOrgViewOption->SetShowPlaceHolderFields( sal_True ); - SW_MOD()->ApplyUsrPref(*pOrgViewOption, this, VIEWOPT_DEST_VIEW_ONLY ); - delete pOrgViewOption; - } - } - - if( !bStartJob ) - { - // Printer konnte nicht gestartet werden - delete pProgress; - return pPrinter->GetError(); - } - - pProgress->Stop(); -//TLPDF pProgress->DeleteOnEndPrint(); -//TLPDF pPrinter->EndJob(); - return pPrinter->GetError(); -} - - - /*-------------------------------------------------------------------- Beschreibung: TabPage fuer applikationsspezifische Druckoptionen --------------------------------------------------------------------*/ @@ -629,4 +354,3 @@ void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb ) } } - -- cgit v1.2.3 From 24e7c7a3173bf1612c9903466e88508852bce390 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 1 Sep 2009 08:22:04 +0000 Subject: #i101242# mail merge printing --- sw/source/ui/dbui/dbmgr.cxx | 371 ++++++++++---------------------------------- 1 file changed, 79 insertions(+), 292 deletions(-) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 8ca8463a379a..c1884e7ccbfc 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -455,114 +455,7 @@ BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) bRet = Merge(&rMergeDesc.rSh); // Mischen break; - case DBMGR_MERGE_MAILMERGE: // Serienbrief - { - SwView& rView = rMergeDesc.rSh.GetView(); -#ifdef TL_NOT_NOW /*TLPDF*/ - SfxDispatcher *pDis = rView.GetViewFrame()->GetDispatcher(); - SfxItemSet aPrintArgs( rView.GetPool(), - SID_SILENT, SID_SILENT, //5528 - SID_ASYNCHRON, SID_ASYNCHRON, //5811 - SID_PRINT_FIRST_PAGE, SID_PRINT_FIRST_PAGE, // 5001 - SID_PRINT_LAST_PAGE, SID_PRINT_LAST_PAGE, // 5002 - SID_PRINT_COPIES, SID_PRINT_COPIES, // 5003 - SID_PRINTER_NAME, SID_PRINTER_NAME, //5322 - SID_SELECTION, SID_SELECTION, //5346 - SID_FILE_NAME, SID_FILE_NAME, // 5507 - SID_PRINT_PAGES, SID_PRINT_PAGES, //6589 - SID_PRINT_COLLATE, SID_PRINT_COLLATE, //6590 - FN_QRY_MERGE, FN_QRY_MERGE, - 0 ); - aPrintArgs.Put(SfxBoolItem(FN_QRY_MERGE, TRUE) ); - - // !! Currently (Jan-2003) silent is defined by supplying *any* - // !! item!! (Thus according to OS it would be silent even when - // !! other items then SID_SILENT would be supplied!) - // !! Therefore it has to be the 0 pointer when not silent. - if(IsMergeSilent()) - { - aPrintArgs.Put( SfxBoolItem(SID_SILENT, TRUE) ); - } - // #i52629# aynchronous printing should only be done in silent mode - otherwise - // the printer dialog does not come up - aPrintArgs.Put( SfxBoolItem( SID_ASYNCHRON, rMergeDesc.bPrintAsync )); - - // convert PropertyValues - const beans::PropertyValue* pPrintOptions = rMergeDesc.aPrintOptions.getConstArray(); - for( sal_Int32 nOption = 0; nOption < rMergeDesc.aPrintOptions.getLength(); ++nOption) - { - if( pPrintOptions[nOption].Name.equalsAscii( "CopyCount" )) - { - sal_Int16 nCopies = 0; - if((pPrintOptions[nOption].Value >>= nCopies) && nCopies > 0) - aPrintArgs.Put( SfxInt16Item( SID_PRINT_COPIES, nCopies )); - } - else if( pPrintOptions[nOption].Name.equalsAscii( "FileName" )) - { - ::rtl::OUString sFileName; - if( (pPrintOptions[nOption].Value >>= sFileName) && sFileName.getLength() > 0) - aPrintArgs.Put( SfxStringItem( SID_FILE_NAME, sFileName )); - } - else if( pPrintOptions[nOption].Name.equalsAscii( "Collate" )) - { - sal_Bool bCollate = sal_False; - if( pPrintOptions[nOption].Value >>= bCollate ) - aPrintArgs.Put( SfxBoolItem( SID_PRINT_COLLATE, bCollate )); - } - else if( pPrintOptions[nOption].Name.equalsAscii( "Pages" )) - { - ::rtl::OUString sPages; - if( (pPrintOptions[nOption].Value >>= sPages) && sPages.getLength() ) - aPrintArgs.Put( SfxStringItem( SID_PRINT_PAGES, sPages )); - } - else if( pPrintOptions[nOption].Name.equalsAscii( "Wait" )) - { - sal_Bool bWait = sal_False; - if( pPrintOptions[nOption].Value >>= bWait ) - aPrintArgs.Put( SfxBoolItem( SID_ASYNCHRON, !bWait )); - } - - } -#endif //def TL_NOT_NOW /*TLPDF*/ - -// TLPDF pDis->Execute( SID_PRINTDOC, -// TLPDF SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, -// TLPDF aPrintArgs ); -#if OSL_DEBUG_LEVEL > 1 - sal_Bool _bVal; - sal_Int16 _nVal; - rtl::OUString _sVal; - const beans::PropertyValue* pPrintOptions = rMergeDesc.aPrintOptions.getConstArray(); - for( sal_Int32 nOption = 0; nOption < rMergeDesc.aPrintOptions.getLength(); ++nOption) - { - rtl::OUString aName( pPrintOptions[nOption].Name ); - uno::Any aVal( pPrintOptions[nOption].Value ); - aVal >>= _bVal; - aVal >>= _nVal; - aVal >>= _sVal; - } -#endif - - // printing should be done synchronous otherwise the document - // might already become invalid during the process - uno::Sequence< beans::PropertyValue > aOptions( rMergeDesc.aPrintOptions ); - const sal_Int32 nOpts = aOptions.getLength(); - aOptions.realloc( nOpts + 1 ); - aOptions[ nOpts ].Name = rtl::OUString::createFromAscii( "Wait" ); - aOptions[ nOpts ].Value <<= sal_True ; - - const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); - if (pModOpt->IsSinglePrintJob()) // single print job per document? - { - rView.ExecPrint( aOptions, sal_False, sal_False ); - } - else - { - // here use the print adaptor top get just one print job - } - } - break; - + case DBMGR_MERGE_MAILMERGE: // printing merge from 'old' merge dialog or from UNO-component case DBMGR_MERGE_MAILING: case DBMGR_MERGE_MAILFILES: case DBMGR_MERGE_SINGLE_FILE: @@ -1060,169 +953,6 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, return bRet; } -/*-- 21.06.2004 09:08:16--------------------------------------------------- - - -----------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) -{ - SwWrtShell* pSh = &rView.GetWrtShell(); - //check if the doc is synchronized and contains at least one linked section - //merge source is already open - rOpt.nMergeCnt = 0; - rOpt.SetPrintSingleJobs( sal_True ); - -//TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); - const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF - vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF - const boost::shared_ptr< vcl::PrinterController > pPrtController( &aPrtAdaptor ); -//TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); -//TLPDF if( rOpt.IsPrintSingleJobs() ) -//TLPDF pPrt->SetEndPrintHdl( Link() ); - - BOOL bUserBreak = FALSE, - bRet = FALSE; - //calculate number of data sets to be printed - - Sequence aViewProperties(16); - PropertyValue* pViewProperties = aViewProperties.getArray(); - pViewProperties[0].Name = C2U("MailMergeCount"); - pViewProperties[0].Value <<= (sal_Int32)rOpt.nMergeCnt; - pViewProperties[1].Name = C2U("PrintGraphics"); - pViewProperties[1].Value <<= (sal_Bool)rOpt.IsPrintGraphic(); - pViewProperties[2].Name = C2U("PrintTables"); - pViewProperties[2].Value <<= (sal_Bool)rOpt.IsPrintTable(); - pViewProperties[3].Name = C2U("PrintDrawings"); - pViewProperties[3].Value <<= (sal_Bool)rOpt.IsPrintDraw(); - pViewProperties[4].Name = C2U("PrintLeftPages"); - pViewProperties[4].Value <<= (sal_Bool)rOpt.IsPrintLeftPage(); - pViewProperties[5].Name = C2U("PrintRightPages"); - pViewProperties[5].Value <<= (sal_Bool)rOpt.IsPrintRightPage(); - pViewProperties[6].Name = C2U("PrintControls"); - pViewProperties[6].Value <<= (sal_Bool)rOpt.IsPrintControl(); - pViewProperties[7].Name = C2U("PrintReversed"); - pViewProperties[7].Value <<= (sal_Bool)rOpt.IsPrintReverse(); - pViewProperties[8].Name = C2U("PrintPaperFromSetup"); - pViewProperties[8].Value <<= (sal_Bool)rOpt.IsPaperFromSetup(); - pViewProperties[9].Name = C2U("PrintFaxName"); - pViewProperties[9].Value <<= rOpt.GetFaxName(); - pViewProperties[10].Name = C2U("PrintAnnotationMode"); - pViewProperties[10].Value <<= (text::NotePrintMode) rOpt.GetPrintPostIts(); - pViewProperties[11].Name = C2U("PrintProspect"); - pViewProperties[11].Value <<= (sal_Bool)rOpt.IsPrintProspect(); - pViewProperties[12].Name = C2U("PrintPageBackground"); - pViewProperties[12].Value <<= (sal_Bool)rOpt.IsPrintPageBackground(); - pViewProperties[13].Name = C2U("PrintBlackFonts"); - pViewProperties[13].Value <<= (sal_Bool)rOpt.IsPrintBlackFont(); - pViewProperties[14].Name = C2U("IsSinglePrintJob"); - pViewProperties[14].Value <<= (sal_Bool)rOpt.IsPrintSingleJobs(); - pViewProperties[15].Name = C2U("PrintEmptyPages"); - pViewProperties[15].Value <<= (sal_Bool)rOpt.IsPrintEmptyPages(); - - rView.SetAdditionalPrintOptions(aViewProperties); - - SwMailMergeConfigItem* pConfigItem = rView.GetMailMergeConfigItem(); - DBG_ASSERT(pConfigItem, "mail merge config item is missing"); - if(!pConfigItem) - return sal_False; - - USHORT nDocStart = pConfigItem->GetPrintRangeStart(); - USHORT nDocEnd = pConfigItem->GetPrintRangeEnd(); - DBG_ASSERT(nDocStart < nDocEnd && nDocEnd <= pConfigItem->GetMergedDocumentCount(), - "merge print settings are not correct"); - - for( sal_uInt32 nPrintDocument = nDocStart; nPrintDocument < nDocEnd; ++nPrintDocument) - { - SwDocMergeInfo& rDocInfo = pConfigItem->GetDocumentMergeInfo(nPrintDocument); - rOpt.aMulti.SelectAll(FALSE); - rOpt.aMulti.Select(Range( rDocInfo.nStartPageInTarget, rDocInfo.nEndPageInTarget ), TRUE ); - - ++rOpt.nMergeAct; - - // launch MailMergeEvent if required - const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc(); - if (pEvtSrc) - { - uno::Reference< XInterface > xRef( (XMailMergeBroadcaster *) pEvtSrc ); - text::MailMergeEvent aEvt( xRef, rView.GetDocShell()->GetModel() ); - pEvtSrc->LaunchMailMergeEvent( aEvt ); - } - - String aTmp; - aTmp += String::CreateFromInt32( rDocInfo.nStartPageInTarget ); - aTmp += '-'; - aTmp += String::CreateFromInt32( rDocInfo.nEndPageInTarget ); - - Sequence aAddViewProperties(1); - PropertyValue* pAddViewProperties = aAddViewProperties.getArray(); - pAddViewProperties[0].Name = C2U("Pages"); - pAddViewProperties[0].Value <<= ::rtl::OUString( aTmp ); - rView.SetAdditionalPrintOptions(aAddViewProperties); - - // TLPDF: What abou this line ??? - rView.SfxViewShell::Print( rProgress, bIsAPI ); // ggf Basic-Macro ausfuehren - if( rOpt.IsPrintSingleJobs() && bRet ) - { - //rOpt.bJobStartet = FALSE; - bRet = FALSE; - } - - bMergeLock = TRUE; - if(rOpt.IsPrintProspect()) - { -//TLPDF if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) -//TLPDF { - pSh->PrintProspectMM( aPrtAdaptor, aAddViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); - bRet = TRUE; -//TLPDF } - } - else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, aAddViewProperties, rOpt ) /* TLPDF */ ) - bRet = TRUE; - bMergeLock = FALSE; - - if( !pPrt->IsJobActive() ) - { - bUserBreak = TRUE; - bRet = FALSE; - break; - } - if( !rOpt.IsPrintSingleJobs() ) - { - String& rJNm = (String&)rOpt.GetJobName(); - rJNm.Erase(); - } - } - - if( rOpt.IsPrintSingleJobs() ) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); - pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); - if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? - aSfxSaveLnk.Call( pTmpPrinter ); -#endif // TL_NOT_NOW /*TLPDF*/ - } - - rOpt.nMergeCnt = 0; - rOpt.nMergeAct = 0; - - nMergeType = DBMGR_INSERT; - - SwDocShell* pDocSh = rView.GetDocShell(); - SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(pDocSh); - - while (pTmpFrm) // Alle Views Invalidieren - { - SwView *pVw = PTR_CAST(SwView, pTmpFrm->GetViewShell()); - if (pVw) - pVw->GetEditWin().Invalidate(); - pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, pDocSh); - } - - return bRet; -} - - /*-------------------------------------------------------------------- Beschreibung: Serienbriefe als einzelne Dokumente speichern @@ -1370,6 +1100,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, // in case of creating a single resulting file this has to be created here SwWrtShell* pTargetShell = 0; SfxObjectShellRef xTargetDocShell; + SwView* pTargetView = 0; std::auto_ptr< utl::TempFile > aTempFile; String sModifiedStartingPageDesc; String sStartingPageDesc; @@ -1382,7 +1113,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, xTargetDocShell->DoInitNew( 0 ); SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE ); - SwView* pTargetView = static_cast( pTargetFrame->GetViewShell() ); + pTargetView = static_cast( pTargetFrame->GetViewShell() ); //initiate SelectShell() to create sub shells pTargetView->AttrChangedNotify( &pTargetView->GetWrtShell() ); @@ -1703,27 +1434,83 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, // save the single output document if(rMergeDescriptor.bCreateSingleFile || bAsSingleFile) { - DBG_ASSERT( aTempFile.get(), "Temporary file not available" ); - INetURLObject aTempFileURL(bAsSingleFile ? sSubject : aTempFile->GetURL()); - SfxMedium* pDstMed = new SfxMedium( - aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ), - STREAM_STD_READWRITE, TRUE ); - pDstMed->SetFilter( pStoreToFilter ); - if(pDstMed->GetItemSet()) + if( rMergeDescriptor.nMergeType != DBMGR_MERGE_MAILMERGE ) { - if(pStoreToFilterOptions ) - pDstMed->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions)); - if(rMergeDescriptor.aSaveToFilterData.getLength()) - pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, makeAny(rMergeDescriptor.aSaveToFilterData))); - } + DBG_ASSERT( aTempFile.get(), "Temporary file not available" ); + INetURLObject aTempFileURL(bAsSingleFile ? sSubject : aTempFile->GetURL()); + SfxMedium* pDstMed = new SfxMedium( + aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ), + STREAM_STD_READWRITE, TRUE ); + pDstMed->SetFilter( pStoreToFilter ); + if(pDstMed->GetItemSet()) + { + if(pStoreToFilterOptions ) + pDstMed->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions)); + if(rMergeDescriptor.aSaveToFilterData.getLength()) + pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, makeAny(rMergeDescriptor.aSaveToFilterData))); + } - xTargetDocShell->DoSaveAs(*pDstMed); - xTargetDocShell->DoSaveCompleted(pDstMed); - if( xTargetDocShell->GetError() ) + xTargetDocShell->DoSaveAs(*pDstMed); + xTargetDocShell->DoSaveCompleted(pDstMed); + if( xTargetDocShell->GetError() ) + { + // error message ?? + ErrorHandler::HandleError( xTargetDocShell->GetError() ); + bLoop = FALSE; + } + } + else if( pTargetView ) // must be available! { - // error message ?? - ErrorHandler::HandleError( xTargetDocShell->GetError() ); - bLoop = FALSE; + //print the target document + #if OSL_DEBUG_LEVEL > 1 + sal_Bool _bVal; + sal_Int16 _nVal; + rtl::OUString _sVal; + const beans::PropertyValue* pDbgPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray(); + for( sal_Int32 nOption = 0; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption) + { + rtl::OUString aName( pDbgPrintOptions[nOption].Name ); + uno::Any aVal( pDbgPrintOptions[nOption].Value ); + aVal >>= _bVal; + aVal >>= _nVal; + aVal >>= _sVal; + } + #endif + // printing should be done synchronously otherwise the document + // might already become invalid during the process + uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions ); + const sal_Int32 nOpts = aOptions.getLength(); + aOptions.realloc( nOpts + 1 ); + aOptions[ nOpts ].Name = rtl::OUString::createFromAscii( "Wait" ); + aOptions[ nOpts ].Value <<= sal_True ; +// aPrintArgs.Put(SfxBoolItem(FN_QRY_MERGE, TRUE) ); +// // #i52629# aynchronous printing should only be done in silent mode - otherwise +// // the printer dialog does not come up +// aPrintArgs.Put( SfxBoolItem( SID_ASYNCHRON, rMergeDescriptor.bPrintAsync )); + // move print options + const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray(); + for( sal_Int32 nOption = 0; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption) + { + if( pPrintOptions[nOption].Name.equalsAscii( "CopyCount" ) + ||( pPrintOptions[nOption].Name.equalsAscii( "FileName" )) + ||( pPrintOptions[nOption].Name.equalsAscii( "Collate" )) + ||( pPrintOptions[nOption].Name.equalsAscii( "Pages" )) + ||( pPrintOptions[nOption].Name.equalsAscii( "Wait" ))) + { + aOptions.realloc( nOpts + 1 ); + aOptions[ nOpts ].Name = pPrintOptions[nOption].Name; + aOptions[ nOpts ].Value = pPrintOptions[nOption].Value ; + } + } + + const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); +// if (pModOpt->IsSinglePrintJob()) +// { +// } +// else +// { + pTargetView->ExecPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync ); +// } } xTargetDocShell->DoClose(); } @@ -2955,6 +2742,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, SwMergeDescriptor aMergeDesc( pImpl->pMergeDialog->GetMergeType(), pView->GetWrtShell(), aDescriptor ); aMergeDesc.sSaveToFilter = pImpl->pMergeDialog->GetSaveFilter(); + aMergeDesc.bCreateSingleFile= true; MergeNew(aMergeDesc); pWorkDoc->SetNewDBMgr( pWorkDBMgr ); @@ -3448,5 +3236,4 @@ void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource ) rDBMgr.aDataSourceParams.DeleteAndDestroy(nPos - 1); } } -} - +} \ No newline at end of file -- cgit v1.2.3 From 9582d9a634f47f3f8fe75f3ac67835bbd154d016 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 1 Sep 2009 08:22:22 +0000 Subject: #i101242# mail merge printing --- sw/source/ui/dbui/mmoutputpage.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 72fc1e122a8e..bcf6b6409744 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -991,6 +991,13 @@ IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG) nEnd = rConfigItem.GetMergedDocumentCount(); } rConfigItem.SetPrintRange( (USHORT)nBegin, (USHORT)nEnd ); + SwDocMergeInfo& rStartInfo = rConfigItem.GetDocumentMergeInfo(nBegin); + SwDocMergeInfo& rEndInfo = rConfigItem.GetDocumentMergeInfo(nEnd - 1); + + rtl::OUString sPages(rtl::OUString::valueOf( rStartInfo.nStartPageInTarget )); + sPages += rtl::OUString::createFromAscii( " - "); + sPages += rtl::OUString::valueOf( rEndInfo.nEndPageInTarget ); + SwWrtShell& rSh = pTargetView->GetWrtShell(); pTargetView->SetMailMergeConfigItem(&rConfigItem, 0, sal_False); if(m_pTempPrinter) @@ -1005,8 +1012,14 @@ IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG) SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher(); SfxBoolItem aMergeSilent(SID_SILENT, sal_False); m_pWizard->enableButtons(WZB_CANCEL, sal_False); - pDis->Execute(SID_PRINTDOCDIRECT, - SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aMergeSilent, 0L); + + uno::Sequence < beans::PropertyValue > aProps( 2 ); + aProps[0]. Name = rtl::OUString::createFromAscii("MonitorVisible"); + aProps[0].Value <<= sal_True; + aProps[1]. Name = rtl::OUString::createFromAscii("Pages"); + aProps[1]. Value <<= sPages; + + pTargetView->ExecPrint( aProps, false, true ); SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, pObjSh)); pTargetView->SetMailMergeConfigItem(0, 0, sal_False); -- cgit v1.2.3 From ba1e298590c503608e5c0b792288e0ef28186e90 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 1 Sep 2009 08:23:11 +0000 Subject: #i101242# print after creation of full output document --- sw/source/ui/uno/unomailmerge.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 3acb1e25bd31..effee6426d45 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -725,6 +725,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( // when mail merge is called as command line macro aMergeDesc.bPrintAsync = sal_False; aMergeDesc.aPrintOptions = aPrintSettings; + aMergeDesc.bCreateSingleFile = true; } else /* FILE and MAIL*/ { -- cgit v1.2.3 From 467351957174c318a81fede4937d0a21fda7828e Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 1 Sep 2009 08:26:48 +0000 Subject: #i101242# single print jobs not supported anymore --- sw/source/ui/envelp/mailmrge.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index fd9caec98c24..97c5a208ec45 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -227,6 +227,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, m_aDialogSize( GetSizePixel() ) { FreeResource(); + aSingleJobsCB.Show(sal_False); // not supported in since cws printerpullpages anymore //task #97066# mailing of form letters is currently not supported aMailingRB.Show(FALSE); aSubjectFT.Show(FALSE); @@ -347,7 +348,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, pModOpt = SW_MOD()->GetModuleConfig(); - aSingleJobsCB.Check(pModOpt->IsSinglePrintJob()); + //aSingleJobsCB.Check(pModOpt->IsSinglePrintJob());// not supported in since cws printerpullpages anymore sal_Int16 nMailingMode(pModOpt->GetMailingFormats()); aFormatSwCB.Check((nMailingMode & TXTFORMAT_OFFICE) != 0); @@ -941,4 +942,3 @@ SwMailMergeFieldConnectionsDlg::~SwMailMergeFieldConnectionsDlg() { } - -- cgit v1.2.3 From 8b9588e75bd53b64fa3d1cd0a006a14e74578f96 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 1 Sep 2009 15:16:12 +0000 Subject: #i101242# applying view options and formatting doc now only done in getRendererCount --- sw/inc/printdata.hxx | 72 +++++---- sw/inc/swprtopt.hxx | 18 ++- sw/inc/unotxdoc.hxx | 31 ++++ sw/inc/viewsh.hxx | 14 +- sw/source/core/view/viewpg.cxx | 20 +-- sw/source/core/view/vprint.cxx | 145 +++++++++++------- sw/source/ui/inc/view.hxx | 4 - sw/source/ui/uiview/pview.cxx | 2 +- sw/source/ui/uiview/view.cxx | 96 ++++++------ sw/source/ui/uno/unotxdoc.cxx | 333 ++++++++++++++++++----------------------- 10 files changed, 383 insertions(+), 352 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 085121060c8e..14303ad40d5d 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -42,10 +42,36 @@ class SwPageFrm; class SwDoc; +class SwDocShell; class ViewShell; class _SetGetExpFlds; class SwViewOption; class OutputDevice; +class SwViewOptionAdjust_Impl; +class SwPrtOptions; +class SwWrtShell; + + +//////////////////////////////////////////////////////////// + + +class SwPrintUIOptions : public vcl::PrinterOptionsHelper +{ + OutputDevice* m_pLast; + +public: + SwPrintUIOptions( BOOL bWeb = FALSE ); + ~SwPrintUIOptions(); + + bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; + bool IsPrintEmptyPages( bool bIsPDFExport ) const; + bool IsPrintTables() const; + bool IsPrintGraphics() const; + bool IsPrintDrawings() const; +}; //////////////////////////////////////////////////////////// @@ -71,7 +97,12 @@ class SwRenderData // -1 indicates a half page to be left empty. std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs; - rtl::OUString m_PageRange; + rtl::OUString m_aPageRange; + + // the view options to be applied for printing + SwViewOptionAdjust_Impl * m_pViewOptionAdjust; + + SwPrtOptions * m_pPrtOptions; public: @@ -89,6 +120,19 @@ public: void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ); void DeletePostItData(); + bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != 0; } + void ViewOptionAdjustStart( SwWrtShell& rSh ); + void ViewOptionAdjustStop(); + + bool HasSwPrtOptions() const { return m_pPrtOptions != 0; } + void SetSwPrtOptions( SwPrtOptions * pOpt ) { m_pPrtOptions = pOpt; } + const SwPrtOptions * GetSwPrtOptions() const { return m_pPrtOptions; } + SwPrtOptions & GetSwPrtOptionsRef() { return *m_pPrtOptions; } + void MakeSwPrtOptions( SwPrtOptions &rOptions, const SwDocShell *pDocShell, + const SwPrintUIOptions *pOpt, const SwRenderData *pData, + bool bIsSkipEmptyPages, bool bIsPDFExport ); + + typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; @@ -117,30 +161,8 @@ public: PagePairsVec_t & GetPagePairsForProspectPrinting() { return m_aPagePairs; } const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return m_aPagePairs; } - rtl::OUString GetPageRange() const { return m_PageRange; } - void SetPageRange( const rtl::OUString &rRange ) { m_PageRange = rRange; } -}; - - -//////////////////////////////////////////////////////////// - - -class SwPrintUIOptions : public vcl::PrinterOptionsHelper -{ - OutputDevice* m_pLast; - -public: - SwPrintUIOptions( BOOL bWeb = FALSE ); - ~SwPrintUIOptions(); - - bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); - - bool IsPrintLeftPages() const; - bool IsPrintRightPages() const; - bool IsPrintEmptyPages( bool bIsPDFExport ) const; - bool IsPrintTables() const; - bool IsPrintGraphics() const; - bool IsPrintDrawings() const; + rtl::OUString GetPageRange() const { return m_aPageRange; } + void SetPageRange( const rtl::OUString &rRange ) { m_aPageRange = rRange; } }; diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index 86bcefa5d455..76930675eb6c 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -45,6 +45,10 @@ #define POSTITS_ENDPAGE 3 +class PrintDialog; +class SfxPrinter; + + //////////////////////////////////////////////////////////// @@ -84,11 +88,15 @@ public: #endif - SwPrtOptions& operator=(const SwPrintData& rData) - { - SwPrintData::operator=(rData); - return *this; - } + SwPrtOptions& operator=(const SwPrintData& rData) + { + SwPrintData::operator=(rData); + return *this; + } + + // get print options + void MakeOptions( PrintDialog* pDlg, + BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, SfxPrinter* pPrt, SwPrintData* pData ); }; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index f2ec7fc21d01..e0fa90de0ac7 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -128,10 +128,15 @@ class SfxViewFrame; class SwPrintUIOptions; class SwPrintData; class SwRenderData; +class SwPrtOptions; +class SwViewOption; +class SwWrtShell; + typedef UnoActionContext* UnoActionContextPtr; SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) + /****************************************************************************** * ******************************************************************************/ @@ -231,6 +236,7 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, // used for XRenderable implementation SfxViewShell * GuessViewShell( const css::uno::Reference< css::frame::XController > xController = css::uno::Reference< css::frame::XController >() ); SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport ); + SfxViewShell * GetRenderView( const SwPrintUIOptions &rOpt, bool bIsPDFExport ); rtl::OUString maBuildId; @@ -432,6 +438,7 @@ public: SwXDrawPage* GetDrawPage(); SwDocShell* GetDocShell() {return pDocShell;} + void * SAL_CALL operator new( size_t ) throw(); void SAL_CALL operator delete( void * ) throw(); @@ -579,3 +586,27 @@ public: virtual void onChange(); }; + + +/*-- 06.01.2004 15:08:34--------------------------------------------------- + The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of + the current ViewShell so that fields are not printed as commands and + hidden text and hidden characters are always invisible. + After printing the view options are restored + -----------------------------------------------------------------------*/ +class SwViewOptionAdjust_Impl +{ + bool m_bSwitchOff_IsFldName; + bool m_bSwitchOff_PlaceHolderView; + bool m_bSwitchOff_HiddenChar; + bool m_bSwitchOff_HiddenParagraphs; + bool m_bSwitchOff_IsShowHiddenField; + + SwViewOption* m_pViewOption; + SwWrtShell& m_rShell; +public: + SwViewOptionAdjust_Impl(SwWrtShell& rSh); + ~SwViewOptionAdjust_Impl(); +}; + + diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 1e09bbde33de..636608279dbb 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -218,8 +218,7 @@ public: const SwNodes& GetNodes() const; //Nach Druckerwechsel, vom Doc - //pPDFOut != NULL is used for PDF export. - void InitPrt( /*TLPDF Printer * ,*/ OutputDevice *pOutDev /* = NULL */ ); + void InitPrt( OutputDevice *pOutDev ); //Klammerung von zusammengehoerenden Aktionen. inline void StartAction(); @@ -380,17 +379,6 @@ public: void PrintProspect( OutputDevice *pOutDev, const SwPrintData &rPrintData, sal_Int32 nRenderer /* offset in vector of page pairs for prospect printing */ ); - // printing of a complete document for mail merge - // bIsPDFExport == true is: do PDF Export (no printing!) - sal_Bool PrintOrPDFExportMM( vcl::OldStylePrintAdaptor &rAdaptor, - const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rOptions, - const SwPrtOptions &rPrintData, bool bIsPDFExport = sal_False ); - - // printing of a complete brochure for mail merge - void PrintProspectMM( vcl::OldStylePrintAdaptor &rAdaptor, - const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rOptions, - const SwPrintData &rPrintData, bool bProspectRTL ); - // printing for OLE 2.0 static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions, OutputDevice* pOleOut, const Rectangle& rRect ); diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index cc97ae5ef3ed..360593897084 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -454,22 +454,6 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, } -void ViewShell::PrintProspectMM( - vcl::OldStylePrintAdaptor &rAdaptor, - const uno::Sequence< beans::PropertyValue > &rOptions, /* TLPDF: this or the above ? */ - const SwPrintData & rPrintData, - bool bProspectRTL ) -{ - (void) rOptions; (void) rAdaptor; (void) rPrintData; (void) bProspectRTL; - // to be removed (not needed) -#ifdef TL_NOT_NOW /* TLPDF */ - - const boost::shared_ptr< vcl::PrinterController > pPrtController( &rAdaptor ); - Printer::PrintJob( pPrtController, JobSetup() ); -#endif // TL_NOT_NOW /* TLPDF */ -} - - // print brochure // OD 05.05.2003 #i14016# - consider empty pages on calculation of the scaling // for a page to be printed. @@ -507,6 +491,7 @@ void ViewShell::PrintProspect( aShell.PrepareForPrint( rPrintData ); +#ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! // gibt es versteckte Absatzfelder, unnoetig wenn die Absaetze bereits // ausgeblendet sind. int bHiddenFlds = FALSE; @@ -524,6 +509,7 @@ void ViewShell::PrintProspect( // Seiten fuers Drucken formatieren aShell.CalcPagesForPrint( nPageMax, 0 /*(USHORT)aPages.Max(), &rProgress*/ ); +#endif // TL_NOT_NOW // TLPDF MapMode aMapMode( MAP_TWIP ); Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ @@ -645,12 +631,14 @@ void ViewShell::PrintProspect( SwPaintQueue::Repaint(); +#ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! if( bHiddenFlds ) { SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); pFldType->Modify( &aHnt, 0); CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); } +#endif // TL_NOT_NOW // TLPDF pFntCache->Flush(); // restore settings of OutputDevice (should be done always now since the diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 1e399b2ee3f7..3016075d1002 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -69,6 +69,7 @@ #include #include #include +#include #include #include #include // Imp->SetFirstVisPageInvalid() @@ -239,22 +240,30 @@ const XubString& SwPrtOptions::MakeNextJobName() /*****************************************************************************/ - SwRenderData::SwRenderData() { m_pPostItFields = 0; m_pPostItDoc = 0; m_pPostItShell = 0; + + m_pViewOptionAdjust = 0; + m_pPrtOptions = 0; } SwRenderData::~SwRenderData() { + delete m_pViewOptionAdjust; m_pViewOptionAdjust = 0; + delete m_pPrtOptions; m_pPrtOptions = 0; + DBG_ASSERT( !m_pPostItShell, "m_pPostItShell should already have been deleted" ); + DBG_ASSERT( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" ); + DBG_ASSERT( !m_pPostItFields, " should already have been deleted" ); } void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ) { + DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" ); m_pPostItFields = new _SetGetExpFlds; lcl_GetPostIts( pDoc, *m_pPostItFields ); m_pPostItDoc = new SwDoc; @@ -283,6 +292,81 @@ void SwRenderData::DeletePostItData() } +void SwRenderData::ViewOptionAdjustStart( SwWrtShell& rSh ) +{ + DBG_ASSERT( !m_pViewOptionAdjust, "m_pViewOptionAdjust already exists" ); + m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh ); +} + + +void SwRenderData::ViewOptionAdjustStop() +{ + if (IsViewOptionAdjust()) + { + delete m_pViewOptionAdjust; + m_pViewOptionAdjust = 0; + } +} + + +void SwRenderData::MakeSwPrtOptions( + SwPrtOptions &rOptions, + const SwDocShell *pDocShell, + const SwPrintUIOptions *pOpt, + const SwRenderData *pData, + bool bIsSkipEmptyPages, + bool bIsPDFExport ) +{ + if (!pDocShell || !pOpt || !pData) + return; + + // get default print options + const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); + BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); + rOptions.MakeOptions( NULL, NULL, NULL, bWeb, NULL, NULL ); + + // get print options to use from provided properties + rOptions.bPrintGraphic = pOpt->IsPrintGraphics(); + rOptions.bPrintTable = pOpt->IsPrintTables(); + rOptions.bPrintDraw = pOpt->IsPrintDrawings(); + rOptions.bPrintControl = pOpt->getBoolValue( "PrintControls", rOptions.bPrintControl ); + rOptions.bPrintLeftPages = pOpt->IsPrintLeftPages(); + rOptions.bPrintRightPages = pOpt->IsPrintRightPages(); + rOptions.bPrintPageBackground = pOpt->getBoolValue( "PrintPageBackground", rOptions.bPrintPageBackground ); + rOptions.bPrintEmptyPages = !bIsSkipEmptyPages; + // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + rOptions.bPaperFromSetup = pOpt->getBoolValue( "PrintPaperFromSetup", rOptions.bPaperFromSetup ); + rOptions.bPrintReverse = pOpt->getBoolValue( "PrintReversed", rOptions.bPrintReverse ); + rOptions.bPrintProspect = pOpt->getBoolValue( "PrintProspect", rOptions.bPrintProspect ); + rOptions.bPrintProspectRTL = pOpt->getIntValue( "PrintProspectRTL", rOptions.bPrintProspectRTL ) ? true : false; + // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + rOptions.bPrintBlackFont = pOpt->getBoolValue( "PrintBlackFonts", rOptions.bPrintBlackFont ); + rOptions.bPrintHiddenText = pOpt->getBoolValue( "PrintHiddenText", rOptions.bPrintHiddenText ); + rOptions.bPrintTextPlaceholder = pOpt->getBoolValue( "PrintTextPlaceholder", rOptions.bPrintTextPlaceholder ); + rOptions.nPrintPostIts = static_cast< sal_Int16 >(pOpt->getIntValue( "PrintAnnotationMode", rOptions.nPrintPostIts )); + + //! needs to be set after MakeOptions since the assignment operation in that + //! function will destroy the pointers + rOptions.SetPrintUIOptions( pOpt ); + rOptions.SetRenderData( pData ); + + // rOptions.aMulti is not used anymore in the XRenderable API but it is still + // used in ViewShell::PrintPreViewPage. Thus we set it to a dummy value here. + MultiSelection aPages( Range( 1, 1 ) ); +// aPages.SetTotalRange( Range( 0, RANGE_MAX ) ); +// aPages.Select( aRange ); + rOptions.aMulti = aPages; + + //! Note: Since for PDF export of (multi-)selection a temporary + //! document is created that contains only the selects parts, + //! and thus that document is to printed in whole the, + //! rOptions.bPrintSelection parameter will be false. + if (bIsPDFExport) + rOptions.bPrintSelection = FALSE; +} + + /*****************************************************************************/ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : @@ -1012,63 +1096,6 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) } -sal_Bool ViewShell::PrintOrPDFExportMM( - vcl::OldStylePrintAdaptor &/*rAdaptor*/, - const uno::Sequence< beans::PropertyValue > &/*rOptions*/, /* TLPDF: this or the above ? */ - const SwPrtOptions &/*rPrintData*/, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ - bool /*bIsPDFExport*/ ) -{ - return false; - // to be removed (not needed) -#ifdef TL_NOT_NOW /* TLPDF */ - (void) rPrintData; (void) bIsPDFExport; - - uno::Reference< frame::XModel > xModel( GetDoc()->GetDocShell()->GetModel() ); - uno::Reference< view::XRenderable > xTextDoc( xModel, uno::UNO_QUERY ); - if (!xModel.is() || xTextDoc.is()) - return sal_False; - - bool bRes = sal_True; - try - { - // print the whole document and not just a selection - uno::Any aSelection; - aSelection <<= xModel; - - const sal_Int32 nPages = xTextDoc->getRendererCount( aSelection, rOptions ); - for (sal_Int32 i = 0; i < nPages; ++i) - { - uno::Sequence< beans::PropertyValue > aRenderProps( xTextDoc->getRenderer( i, aSelection, rOptions ) ); - if (i == 0 || i == nPages - 1) - { - rtl::OUString aName( rtl::OUString::createFromAscii( i == 0 ? "IsFirstPage" : "IsLastPage" ) ); - const sal_Int32 nProps = aRenderProps.getLength(); - aRenderProps.realloc( nProps + 1 ); - aRenderProps[ nProps ].Name = aName; - aRenderProps[ nProps ].Value <<= sal_True; - } - - rAdaptor.StartPage(); - xTextDoc->render( i, aSelection, aRenderProps ); - rAdaptor.EndPage(); - } - } - catch (uno::Exception &r) - { - (void) r; - bRes = sal_False; - } - - if (bRes) - { - const boost::shared_ptr< vcl::PrinterController > pPrtController( &rAdaptor ); - Printer::PrintJob( pPrtController, JobSetup() ); - } - return bRes; -#endif // TL_NOT_NOW /* TLPDF */ -} - - sal_Bool ViewShell::PrintOrPDFExport( OutputDevice *pOutDev, const SwPrtOptions &rPrintData, @@ -1169,6 +1196,7 @@ sal_Bool ViewShell::PrintOrPDFExport( } DBG_ASSERT( pStPage, "failed to get start page" ); +#ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! // benoetigte Seiten fuers Drucken formatieren pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, 0 /*TLPDFpStr*/, 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); @@ -1182,6 +1210,7 @@ sal_Bool ViewShell::PrintOrPDFExport( if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) pShell->UpdateFlds(TRUE); // <-- +#endif // TL_NOT_NOW // TLPDF ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ rPrintData.GetRenderData().m_pPostItShell : pShell; diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 92788e714c4f..d122df20c408 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -630,10 +630,6 @@ public: //apply Accessiblity options void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions); - // get print options (SwPrtOptions) - static void MakeOptions( PrintDialog* pDlg, SwPrtOptions& rOpts, - BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, SfxPrinter* pPrt, SwPrintData* pData ); - SwView(SfxViewFrame* pFrame, SfxViewShell*); ~SwView(); diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 1dc6c393dfcf..81958e19be19 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1779,7 +1779,7 @@ void SwPagePreView::Init(const SwViewOption * pPrefs) // OD 09.01.2003 #i6467# - adjust view shell option to the same as for print SwPrtOptions aPrintOptions( GetViewFrame()->GetObjectShell()->GetTitle(0) ); - SwView::MakeOptions( 0, aPrintOptions, 0, 0, false, 0, 0 ); + aPrintOptions.MakeOptions( 0, 0, 0, false, 0, 0 ); GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions ); IDocumentSettingAccess* pIDSA = pESh->getIDocumentSettingAccess(); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 642c34352a0e..1dedc5c67487 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1958,8 +1958,40 @@ void SwView::NotifyDBChanged() Beschreibung: Drucken --------------------------------------------------------------------*/ -void SwView::MakeOptions( PrintDialog* pDlg, SwPrtOptions& rOpts, - BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, SfxPrinter* pPrt, SwPrintData* pData ) +/* -----------------------------28.10.02 13:25-------------------------------- + + ---------------------------------------------------------------------------*/ +SfxObjectShellRef & SwView::GetTmpSelectionDoc() +{ + return GetViewImpl()->GetTmpSelectionDoc(); +} +/* -----------------------------31.10.02 13:25-------------------------------- + + ---------------------------------------------------------------------------*/ +SfxObjectShellRef & SwView::GetOrCreateTmpSelectionDoc() +{ + SfxObjectShellRef &rxTmpDoc = GetViewImpl()->GetTmpSelectionDoc(); + if (!rxTmpDoc.Is()) + { + SwXTextView *pImpl = GetViewImpl()->GetUNOObject_Impl(); + rxTmpDoc = pImpl->BuildTmpSelectionDoc( + GetViewImpl()->GetEmbeddedObjRef() ); + } + return rxTmpDoc; +} +/* -----------------3/31/2003 12:39PM---------------- + + --------------------------------------------------*/ +void SwView::AddTransferable(SwTransferable& rTransferable) +{ + GetViewImpl()->AddTransferable(rTransferable); +} + +/* --------------------------------------------------*/ + +void SwPrtOptions::MakeOptions( PrintDialog* pDlg, + BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, + SfxPrinter* pPrt, SwPrintData* pData ) { SwAddPrinterItem* pAddPrinterAttr; if( pPrt && SFX_ITEM_SET == pPrt->GetOptions().GetItemState( @@ -1971,65 +2003,37 @@ void SwView::MakeOptions( PrintDialog* pDlg, SwPrtOptions& rOpts, { pData = SW_MOD()->GetPrtOptions(bWeb); } - rOpts = *pData; + *this = *pData; if( pPrtProspect ) *pPrtProspect = pData->bPrintProspect; if( pPrtProspect_RTL ) *pPrtProspect_RTL = pData->bPrintProspectRTL; - rOpts.aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); - rOpts.aMulti.SelectAll( FALSE ); - rOpts.nCopyCount = 1; - rOpts.bCollate = FALSE; - rOpts.bPrintSelection = FALSE; - rOpts.bJobStartet = FALSE; + aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); + aMulti.SelectAll( FALSE ); + nCopyCount = 1; + bCollate = FALSE; + bPrintSelection = FALSE; + bJobStartet = FALSE; if ( pDlg ) { - rOpts.nCopyCount = pDlg->GetCopyCount(); - rOpts.bCollate = pDlg->IsCollateChecked(); + nCopyCount = pDlg->GetCopyCount(); + bCollate = pDlg->IsCollateChecked(); if ( pDlg->GetCheckedRange() == PRINTDIALOG_SELECTION ) { - rOpts.aMulti.SelectAll(); - rOpts.bPrintSelection = TRUE; + aMulti.SelectAll(); + bPrintSelection = TRUE; } else if ( PRINTDIALOG_ALL == pDlg->GetCheckedRange() ) - rOpts.aMulti.SelectAll(); + aMulti.SelectAll(); else { - rOpts.aMulti = MultiSelection( pDlg->GetRangeText() ); - rOpts.aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); + aMulti = MultiSelection( pDlg->GetRangeText() ); + aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); } } else - rOpts.aMulti.SelectAll(); - rOpts.aMulti.Select( 0, FALSE ); + aMulti.SelectAll(); + aMulti.Select( 0, FALSE ); } -/* -----------------------------28.10.02 13:25-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxObjectShellRef & SwView::GetTmpSelectionDoc() -{ - return GetViewImpl()->GetTmpSelectionDoc(); -} -/* -----------------------------31.10.02 13:25-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxObjectShellRef & SwView::GetOrCreateTmpSelectionDoc() -{ - SfxObjectShellRef &rxTmpDoc = GetViewImpl()->GetTmpSelectionDoc(); - if (!rxTmpDoc.Is()) - { - SwXTextView *pImpl = GetViewImpl()->GetUNOObject_Impl(); - rxTmpDoc = pImpl->BuildTmpSelectionDoc( - GetViewImpl()->GetEmbeddedObjRef() ); - } - return rxTmpDoc; -} -/* -----------------3/31/2003 12:39PM---------------- - - --------------------------------------------------*/ -void SwView::AddTransferable(SwTransferable& rTransferable) -{ - GetViewImpl()->AddTransferable(rTransferable); -} diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index eafa1127afe5..82411d62bdb5 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2452,100 +2452,6 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName } return aAny; } -/*-- 06.01.2004 15:08:34--------------------------------------------------- - The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of - the current ViewShell so that fields are not printed as commands and - hidden text and hidden characters are always invisible. - After printing the view options are restored - -----------------------------------------------------------------------*/ -class SwViewOptionAdjust_Impl -{ - bool m_bSwitchOff_IsFldName; - bool m_bSwitchOff_PlaceHolderView; - bool m_bSwitchOff_HiddenChar; - bool m_bSwitchOff_HiddenParagraphs; - bool m_bSwitchOff_IsShowHiddenField; - - SwViewOption* m_pViewOption; - SwWrtShell& m_rShell; -public: - SwViewOptionAdjust_Impl(SwWrtShell& rSh); - ~SwViewOptionAdjust_Impl(); -}; -/*-- 06.01.2004 15:08:34--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl(SwWrtShell& rSh) : - m_pViewOption(0), - m_rShell(rSh) -{ - const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions(); - m_bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && m_rShell.IsAnyFieldInDoc(); - bool bApplyViewOptions = m_bSwitchOff_IsFldName; - //switch off painting of placeholder fields - m_bSwitchOff_PlaceHolderView = pCurrentViewOptions->IsShowPlaceHolderFields(); - //switch off display of hidden characters if on and hidden characters are in use - m_bSwitchOff_HiddenChar = pCurrentViewOptions->IsShowHiddenChar() && m_rShell.GetDoc()->ContainsHiddenChars(); - //switch off display of hidden paragraphs if on and hidden paragraphs are in use - m_bSwitchOff_HiddenParagraphs = pCurrentViewOptions->IsShowHiddenPara(); - if(m_bSwitchOff_HiddenParagraphs) - { - const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENPARAFLD); - if(!pFldType || !pFldType->GetDepends()) - m_bSwitchOff_HiddenParagraphs = false; - } - m_bSwitchOff_IsShowHiddenField = pCurrentViewOptions->IsShowHiddenField(); - if(m_bSwitchOff_IsShowHiddenField) - { - const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENTXTFLD); - if( !pFldType || !pFldType->GetDepends()) - m_bSwitchOff_IsShowHiddenField = false; - } - - bApplyViewOptions |= m_bSwitchOff_PlaceHolderView; - bApplyViewOptions |= m_bSwitchOff_HiddenChar; - bApplyViewOptions |= m_bSwitchOff_HiddenParagraphs; - bApplyViewOptions |= m_bSwitchOff_IsShowHiddenField; - if(bApplyViewOptions) - { - m_pViewOption = new SwViewOption(*m_rShell.GetViewOptions()); - if(m_bSwitchOff_IsFldName) - m_pViewOption->SetFldName(FALSE); - if(m_bSwitchOff_PlaceHolderView) - m_pViewOption->SetShowPlaceHolderFields(FALSE); - if(m_bSwitchOff_HiddenChar) - m_pViewOption->SetShowHiddenChar(FALSE); - if(m_bSwitchOff_HiddenParagraphs) - m_pViewOption->SetShowHiddenPara(FALSE); - if(m_bSwitchOff_IsShowHiddenField) - m_pViewOption->SetShowHiddenField(FALSE); - SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); - } -} -/*-- 06.01.2004 15:08:34--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() -{ - if(m_pViewOption) - { - if(m_bSwitchOff_IsFldName) - m_pViewOption->SetFldName(TRUE); - if(m_bSwitchOff_PlaceHolderView) - m_pViewOption->SetShowPlaceHolderFields(TRUE); - if(m_bSwitchOff_HiddenChar) - m_pViewOption->SetShowHiddenChar(TRUE); - if(m_bSwitchOff_HiddenParagraphs) - m_pViewOption->SetShowHiddenPara(TRUE); - if(m_bSwitchOff_IsShowHiddenField) - m_pViewOption->SetShowHiddenField(TRUE); - SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); - delete m_pViewOption; - } -} -/* -----------------------------23.08.02 16:00-------------------------------- - - ---------------------------------------------------------------------------*/ static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions ) { @@ -2564,6 +2470,26 @@ static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptio } +SfxViewShell * SwXTextDocument::GetRenderView( const SwPrintUIOptions &rOpt, bool bIsPDFExport ) +{ + // get view shell to use + SfxViewShell *pView = 0; + if (bIsPDFExport) + pView = GuessViewShell(); + else + { + uno::Any aTmp( rOpt.getValue( C2U( "View" ) )); + uno::Reference< frame::XController > xController; + if (aTmp >>= xController) + { + DBG_ASSERT( xController.is(), "controller is empty!" ); + pView = GuessViewShell( xController ); + } + } + return pView; +} + + /* * GetRenderDoc: * returns the document to be rendered, usually this will be the 'regular' @@ -2628,19 +2554,27 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); - if( ! m_pRenderData ) + // actually m_pRenderData and m_pPrintUIOptions should have already been + // destroyed in 'render' when IsLastPage was set (or should have been set) + if (m_pRenderData) + delete m_pRenderData, m_pRenderData = 0; + if (m_pPrintUIOptions) + delete m_pPrintUIOptions, m_pPrintUIOptions = 0; + + if (! m_pRenderData) m_pRenderData = new SwRenderData; - if( ! m_pPrintUIOptions ) + if (! m_pPrintUIOptions) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - SfxViewShell *pView = 0; + SfxViewShell *pView = GetRenderView( *m_pPrintUIOptions, bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); - if (!pDoc) + if (!pDoc || !pView) throw RuntimeException(); SwDocShell *pRenderDocShell = pDoc->GetDocShell(); @@ -2661,7 +2595,15 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( pWrtShell = pSwView->GetWrtShellPtr(); } - SwViewOptionAdjust_Impl aAdjust(*pWrtShell); + m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); + m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, + m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); + + //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); + const TypeId aSwViewTypeId = TYPE(SwView); + if (pView->IsA(aSwViewTypeId)) + m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr() ); + if( bFormat ) { // since printing now also use the API for PDF export this option @@ -2671,7 +2613,12 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // --> FME 2005-05-23 #122919# Force field update before PDF export: pWrtShell->ViewShell::UpdateFlds(TRUE); // <-- + + // there is some redundancy between those two fucntion calls, but right now + // there is no time to sort this out. + //TODO: check what exatly needs to be done and make just one function for that pWrtShell->CalcLayout(); + pWrtShell->CalcPagesForPrint( pDoc->GetPageCount() ); pWrtShell->SetPDFExportOption( sal_False ); } @@ -2725,8 +2672,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if(!IsValid()) throw RuntimeException(); - if( ! m_pRenderData ) - m_pRenderData = new SwRenderData; + DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." ); + DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." ); +// if( ! m_pRenderData ) +// m_pRenderData = new SwRenderData; if( ! m_pPrintUIOptions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); @@ -2735,9 +2684,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( m_pPrintUIOptions->processProperties( rxOptions ); const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); - SfxViewShell *pView = 0; + SfxViewShell *pView = GetRenderView( *m_pPrintUIOptions, bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); - if (!pDoc) + if (!pDoc || !pView) throw RuntimeException(); // due to #110067# (document page count changes sometimes during @@ -2805,9 +2754,6 @@ SfxViewShell * SwXTextDocument::GuessViewShell( dynamic_cast< SfxViewShell * >(pSwPagePreView); } -/* -----------------------------23.08.02 16:00-------------------------------- - - ---------------------------------------------------------------------------*/ void SAL_CALL SwXTextDocument::render( sal_Int32 nRenderer, @@ -2819,6 +2765,8 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); + DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." ); + DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." ); if (!m_pRenderData) m_pRenderData = new SwRenderData; if (!m_pPrintUIOptions) @@ -2830,21 +2778,7 @@ void SAL_CALL SwXTextDocument::render( const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); - // get view shell to use - SfxViewShell *pView = 0; - if (bIsPDFExport) - pView = GuessViewShell(); - else - { - uno::Any aTmp( m_pPrintUIOptions->getValue( C2U( "View" ) )); - uno::Reference< frame::XController > xController; - if (aTmp >>= xController) - { - DBG_ASSERT( xController.is(), "controller is empty!" ); - pView = GuessViewShell( xController ); - } - } - + SfxViewShell *pView = GetRenderView( *m_pPrintUIOptions, bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); if (!pDoc || !pView) @@ -2873,63 +2807,18 @@ void SAL_CALL SwXTextDocument::render( } // get output device to use - OutputDevice* pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); + OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); - if(pVwSh && pOut) + if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) { - // TLPDF2DO: clean-up, need to check if only one of aOptions and m_pPrintUIOptions should be used - SwPrtOptions aOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ); - - // get default print options - const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); - BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); - SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); - - // get print options to use from provided properties const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - aOptions.bPrintGraphic = m_pPrintUIOptions->IsPrintGraphics(); - aOptions.bPrintTable = m_pPrintUIOptions->IsPrintTables(); - aOptions.bPrintDraw = m_pPrintUIOptions->IsPrintDrawings(); - aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( "PrintControls", aOptions.bPrintControl ); - aOptions.bPrintLeftPages = m_pPrintUIOptions->IsPrintLeftPages(); - aOptions.bPrintRightPages = m_pPrintUIOptions->IsPrintRightPages(); - aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( "PrintPageBackground", aOptions.bPrintPageBackground ); - aOptions.bPrintEmptyPages = !bIsSkipEmptyPages; - // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", aOptions.bPaperFromSetup ); - aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( "PrintReversed", aOptions.bPrintReverse ); - aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", aOptions.bPrintProspect ); - aOptions.bPrintProspectRTL = m_pPrintUIOptions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspectRTL ) ? true : false; - // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( "PrintBlackFonts", aOptions.bPrintBlackFont ); - aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); - aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintTextPlaceholder", aOptions.bPrintTextPlaceholder ); - aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", aOptions.nPrintPostIts )); - - //! needs to be set after MakeOptions since the assignment operation in that - //! function will destroy the pointers - aOptions.SetPrintUIOptions( m_pPrintUIOptions ); - aOptions.SetRenderData( m_pRenderData ); - - Range aRange( nRenderer+1, nRenderer+1 ); - MultiSelection aPages( aRange ); - aPages.SetTotalRange( Range( 0, RANGE_MAX ) ); - aPages.Select( aRange ); - aOptions.aMulti = aPages; - - //! Note: Since for PDF export of (multi-)selection a temporary - //! document is created that contains only the selects parts, - //! and thus that document is to printed in whole the, - //! aOptions.bPrintSelection parameter will be false. - if (bIsPDFExport) - aOptions.bPrintSelection = FALSE; - - SwViewOptionAdjust_Impl* pViewOptionAdjust = pView->IsA(aSwViewTypeId) ? - new SwViewOptionAdjust_Impl(*((SwView*)pView)->GetWrtShellPtr()) : 0; + + DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) + || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), + "SwView / SwViewOptionAdjust_Impl availability mismatch" ); // since printing now also use the API for PDF export this option // should be set for printing as well ... @@ -2945,17 +2834,17 @@ void SAL_CALL SwXTextDocument::render( ((SwView*)pView)->GetWrtShellPtr() : 0; - if (bIsPDFExport && bFirstPage && pWrtShell) /*TLPDF*/ + if (bIsPDFExport && bFirstPage && pWrtShell) { SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); } // <-- - // TLPDF OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF + const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions(); if (bPrintProspect) - pVwSh->PrintProspect( pOut, aOptions, nRenderer ); + pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); else // normal printing and PDF export - pVwSh->PrintOrPDFExport( pOut, aOptions, nRenderer, bIsPDFExport ); + pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer, bIsPDFExport ); // --> FME 2004-10-08 #i35176# // @@ -2963,7 +2852,7 @@ void SAL_CALL SwXTextDocument::render( // from the EditEngine. The links are generated during the painting // process, but the destinations are still missing. // - if (bIsPDFExport && bLastPage && pWrtShell) /*TLPDF*/ + if (bIsPDFExport && bLastPage && pWrtShell) { SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); } @@ -2971,12 +2860,15 @@ void SAL_CALL SwXTextDocument::render( pVwSh->SetPDFExportOption( sal_False ); - // #i96167# haggai: delete pViewOptionsAdjust here because it makes use - // of the shell, which might get destroyed in lcl_DisposeView! - delete pViewOptionAdjust; - + // last page to be rendered? (not necessarily the last page of the document) + // -> do clean-up of data if (bLastPage) { + // #i96167# haggai: delete pViewOptionsAdjust here because it makes use + // of the shell, which might get destroyed in lcl_DisposeView! + if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) + m_pRenderData->ViewOptionAdjustStop(); + if (m_pRenderData && m_pRenderData->HasPostItData()) m_pRenderData->DeletePostItData(); if (m_pHiddenViewFrame) @@ -2985,8 +2877,6 @@ void SAL_CALL SwXTextDocument::render( m_pHiddenViewFrame = 0; } - aOptions.SetRenderData( NULL ); - aOptions.SetPrintUIOptions( NULL ); delete m_pRenderData; m_pRenderData = NULL; delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; } @@ -3948,3 +3838,78 @@ void SwXDocumentPropertyHelper::onChange() if(m_pDoc) m_pDoc->SetModified(); } + + +/*****************************************************************************/ + +SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl(SwWrtShell& rSh) : + m_pViewOption(0), + m_rShell(rSh) +{ + const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions(); + m_bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && m_rShell.IsAnyFieldInDoc(); + bool bApplyViewOptions = m_bSwitchOff_IsFldName; + //switch off painting of placeholder fields + m_bSwitchOff_PlaceHolderView = pCurrentViewOptions->IsShowPlaceHolderFields(); + //switch off display of hidden characters if on and hidden characters are in use + m_bSwitchOff_HiddenChar = pCurrentViewOptions->IsShowHiddenChar() && m_rShell.GetDoc()->ContainsHiddenChars(); + //switch off display of hidden paragraphs if on and hidden paragraphs are in use + m_bSwitchOff_HiddenParagraphs = pCurrentViewOptions->IsShowHiddenPara(); + if(m_bSwitchOff_HiddenParagraphs) + { + const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENPARAFLD); + if(!pFldType || !pFldType->GetDepends()) + m_bSwitchOff_HiddenParagraphs = false; + } + m_bSwitchOff_IsShowHiddenField = pCurrentViewOptions->IsShowHiddenField(); + if(m_bSwitchOff_IsShowHiddenField) + { + const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENTXTFLD); + if( !pFldType || !pFldType->GetDepends()) + m_bSwitchOff_IsShowHiddenField = false; + } + + bApplyViewOptions |= m_bSwitchOff_PlaceHolderView; + bApplyViewOptions |= m_bSwitchOff_HiddenChar; + bApplyViewOptions |= m_bSwitchOff_HiddenParagraphs; + bApplyViewOptions |= m_bSwitchOff_IsShowHiddenField; + if(bApplyViewOptions) + { + m_pViewOption = new SwViewOption(*m_rShell.GetViewOptions()); + if(m_bSwitchOff_IsFldName) + m_pViewOption->SetFldName(FALSE); + if(m_bSwitchOff_PlaceHolderView) + m_pViewOption->SetShowPlaceHolderFields(FALSE); + if(m_bSwitchOff_HiddenChar) + m_pViewOption->SetShowHiddenChar(FALSE); + if(m_bSwitchOff_HiddenParagraphs) + m_pViewOption->SetShowHiddenPara(FALSE); + if(m_bSwitchOff_IsShowHiddenField) + m_pViewOption->SetShowHiddenField(FALSE); + SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); + } +} + + +SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() +{ + if(m_pViewOption) + { + if(m_bSwitchOff_IsFldName) + m_pViewOption->SetFldName(TRUE); + if(m_bSwitchOff_PlaceHolderView) + m_pViewOption->SetShowPlaceHolderFields(TRUE); + if(m_bSwitchOff_HiddenChar) + m_pViewOption->SetShowHiddenChar(TRUE); + if(m_bSwitchOff_HiddenParagraphs) + m_pViewOption->SetShowHiddenPara(TRUE); + if(m_bSwitchOff_IsShowHiddenField) + m_pViewOption->SetShowHiddenField(TRUE); + SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); + delete m_pViewOption; + } +} + +/*****************************************************************************/ + + -- cgit v1.2.3 From b4c51335262a4f3ad88d15d3b13d5442e90b142b Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 1 Sep 2009 15:41:59 +0000 Subject: #i101242# applying view options and formatting doc now only done in getRendererCount --- sw/source/core/doc/doc.cxx | 55 +----------------------------------------- sw/source/core/view/vprint.cxx | 29 ---------------------- sw/source/ui/dbui/dbmgr.cxx | 6 ++--- 3 files changed, 4 insertions(+), 86 deletions(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index daefe8fef56f..2c125bcb98e4 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1149,8 +1149,6 @@ void SwDoc::CalculatePagesForPrinting( // (PDF export UI does not allow for selecting left or right pages only) bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages(); bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages(); - // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now -//TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); bool bPrintEmptyPages = rOptions.IsPrintEmptyPages( bIsPDFExport ); Range aPages( 1, nDocPageCount ); @@ -1211,17 +1209,7 @@ void SwDoc::CalculatePagesForPrinting( aMulti = aTmpMulti; // Ende des HACKs -#ifdef TL_NOT_NOW /*TLPDF*/ - if (bPrintReverse) - { - const SwFrm *pTmp = pStPage; - pStPage = (SwPageFrm*)pEndPage; - pEndPage = pTmp; - nPageNo = nLastPageNo; - } - else -#endif // TL_NOT_NOW /*TLPDF*/ - nPageNo = nFirstPageNo; + nPageNo = nFirstPageNo; std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); @@ -1248,13 +1236,6 @@ void SwDoc::CalculatePagesForPrinting( { pStPage = 0; } -#ifdef TL_NOT_NOW /*TLPDF*/ - else if ( bPrintReverse ) - { - --nPageNo; - pStPage = (SwPageFrm*)pStPage->GetPrev(); - } -#endif // TL_NOT_NOW /*TLPDF*/ else { ++nPageNo; pStPage = (SwPageFrm*)pStPage->GetNext(); @@ -1565,40 +1546,6 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // with back and front) while( aVec.size() & 3 ) aVec.push_back( 0 ); - -#ifdef TL_NOT_NOW /*TLPDF*/ - if ( bPrintReverse && 4 < aVec.size() ) - { - // das Array umsortieren - // Array: 1 2 3 4 5 6 7 8 - // soll: 3 4 1 2 7 8 5 6 - // Algorhitmus: - // vordere Haelfte: Austausch von 2 Pointer von Vorne vor die Haelfte - // hintere Haelfte: Austausch von 2 Pointer von der Haelfte nach hinten - - USHORT nHalf = aVec.size() / 2; - USHORT nSwapCount = nHalf / 4; - - const SwPageFrm ** ppArrStt = &aVec[ 0 ]; - const SwPageFrm ** ppArrHalf = &aVec[ nHalf ]; - - for ( int k = 0; k < 2; ++k ) - { - for ( USHORT n = 0; n < nSwapCount; ++n ) - { - const SwPageFrm * pTmp = *ppArrStt; - *ppArrStt++ = *(ppArrHalf-2); - *(ppArrHalf-2) = pTmp; - - pTmp = *ppArrStt; - *ppArrStt++ = *--ppArrHalf; - *ppArrHalf-- = pTmp; - } - ppArrStt = &aVec[ nHalf ]; - ppArrHalf = &aVec[ 0 ] + aVec.size(); - } - } -#endif // TL_NOT_NOW /*TLPDF*/ } // dann sorge mal dafuer, das alle Seiten in der richtigen diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 3016075d1002..4a6eb22134d3 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -851,36 +851,12 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, const SwFrm *pPage = pLayout->Lower(); SwLayAction aAction( pLayout, Imp() ); -#ifdef TL_NOT_NOW /*TLPDF*/ -//Currently we have no progress bar here. It is handled in the new Print UI now. -//Not year clear: what about Progressbar in MailMerge - if( pProgress ) - { - // HACK, damit die Anzeige sich nicht verschluckt. - const XubString aTmp( SW_RES( STR_STATSTR_FORMAT ) ); - pProgress->SetText( aTmp ); - lcl_SetState( *pProgress, 1, nStatMax, pStr, nMergeAct, nMergeCnt, 0, 1 ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - aAction.SetProgress(pProgress); - } -#endif // TL_NOT_NOW /*TLPDF*/ - pLayout->StartAllAction(); for ( USHORT i = 1; pPage && i <= nMax; pPage = pPage->GetNext(), ++i ) { if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) break; -#ifdef TL_NOT_NOW /*TLPDF*/ - if( pProgress ) - { - //HACK, damit die Anzeige sich nicht verschluckt. - if ( i > nStatMax ) nStatMax = i; - lcl_SetState( *pProgress, i, nStatMax, pStr, nMergeAct, nMergeCnt, 0, i ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } -#endif // TL_NOT_NOW /*TLPDF*/ - if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) break; @@ -898,11 +874,6 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, aVisArea = aOldVis; //Zuruecksetzen wg. der Paints! Imp()->SetFirstVisPageInvalid(); SwPaintQueue::Repaint(); - -#ifdef TL_NOT_NOW /*TLPDF*/ - if ( pProgress ) - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? -#endif // TL_NOT_NOW /*TLPDF*/ } if (pProgress) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index c1884e7ccbfc..2e2b43339124 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -900,10 +900,10 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, bRet = TRUE; } #endif // TL_NOT_NOW /*TLPDF*/ - pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); // TLPDF +//TLPDFXX pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); // TLPDF bRet = TRUE; // TLPDF } - else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, rOpt ) /* TLPDF */ ) + else if( 1 /*TLPDFXX pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, rOpt ) */ ) bRet = TRUE; bMergeLock = FALSE; @@ -3236,4 +3236,4 @@ void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource ) rDBMgr.aDataSourceParams.DeleteAndDestroy(nPos - 1); } } -} \ No newline at end of file +} -- cgit v1.2.3 From 65756e786d115472d3607724456888d325608a95 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 1 Sep 2009 16:31:53 +0000 Subject: remove warnings --- sw/source/core/view/viewpg.cxx | 4 ++-- sw/source/core/view/vprint.cxx | 2 +- sw/source/ui/dbui/dbmgr.cxx | 2 +- sw/source/ui/dbui/mmoutputpage.cxx | 2 +- sw/source/ui/inc/view.hxx | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 360593897084..8f33348afc31 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -477,8 +477,8 @@ void ViewShell::PrintProspect( std::pair< sal_Int32, sal_Int32 > rPagesToPrint = rPrintData.GetRenderData().GetPagePairsForProspectPrinting()[ nRenderer ]; - const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? - rPagesToPrint.first : rPagesToPrint.second); +// const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? +// rPagesToPrint.first : rPagesToPrint.second); #if OSL_DEBUG_LEVEL > 1 DBG_ASSERT( rPagesToPrint.first == -1 || rPrintData.GetRenderData().GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); DBG_ASSERT( rPagesToPrint.second == -1 || rPrintData.GetRenderData().GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 4a6eb22134d3..ec5a7900fc4e 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1071,7 +1071,7 @@ sal_Bool ViewShell::PrintOrPDFExport( OutputDevice *pOutDev, const SwPrtOptions &rPrintData, sal_Int32 nRenderer, // the index in the vector of pages to be printed - bool bIsPDFExport ) + bool /* TLPDF bIsPDFExport*/ ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //Immer die Druckroutinen in viewpg.cxx (PrintPreViewPage und PrintProspect) mitpflegen!! diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 2e2b43339124..dee7803a9798 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1503,7 +1503,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, } } - const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); +// const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig(); // if (pModOpt->IsSinglePrintJob()) // { // } diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index bcf6b6409744..dd88026ce204 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -1009,7 +1009,7 @@ IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG) SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell(); SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, pObjSh)); rSh.GetNewDBMgr()->SetMergeType( DBMGR_MERGE_DOCUMENTS ); - SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher(); + //SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher(); SfxBoolItem aMergeSilent(SID_SILENT, sal_False); m_pWizard->enableButtons(WZB_CANCEL, sal_False); diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index d122df20c408..b181c85fa5ae 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -685,4 +685,5 @@ SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions, BOOL bPreview); -#endif \ No newline at end of file +#endif + -- cgit v1.2.3 From ffdf4f75143bbcc0061cbf8479490d9b6cb7d5f2 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 1 Sep 2009 17:48:55 +0000 Subject: #i101242# applying view options and formatting doc now only done in getRendererCount --- sw/source/core/view/viewpg.cxx | 2 +- sw/source/core/view/vprint.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 8f33348afc31..c3da2df6cf37 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -468,7 +468,7 @@ void ViewShell::PrintProspect( DBG_ASSERT( 0 <= nRenderer && nRenderer < nMaxRenderer, "nRenderer out of bounds"); #endif Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); - if (!pPrinter || nMaxRenderer <= 0 || nRenderer < 0 || nRenderer > nMaxRenderer) + if (!pPrinter || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer) return; // save settings of OutputDevice (should be done always since the diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ec5a7900fc4e..081017f1aeb3 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -1081,7 +1081,7 @@ sal_Bool ViewShell::PrintOrPDFExport( #if OSL_DEBUG_LEVEL > 1 DBG_ASSERT( 0 <= nRenderer && nRenderer < nMaxRenderer, "nRenderer out of bounds"); #endif - if (!pOutDev || nMaxRenderer <= 0 || nRenderer < 0 || nRenderer > nMaxRenderer) + if (!pOutDev || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer) return sal_False; // save settings of OutputDevice (should be done always since the diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 82411d62bdb5..fb765915f5b0 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2556,10 +2556,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // actually m_pRenderData and m_pPrintUIOptions should have already been // destroyed in 'render' when IsLastPage was set (or should have been set) - if (m_pRenderData) - delete m_pRenderData, m_pRenderData = 0; - if (m_pPrintUIOptions) - delete m_pPrintUIOptions, m_pPrintUIOptions = 0; +// if (m_pRenderData) +// delete m_pRenderData, m_pRenderData = 0; +// if (m_pPrintUIOptions) +// delete m_pPrintUIOptions, m_pPrintUIOptions = 0; if (! m_pRenderData) m_pRenderData = new SwRenderData; -- cgit v1.2.3 From 4c0bd776257fb1ad287e34b4e1bcf4bb6cd2f822 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 3 Sep 2009 15:12:37 +0000 Subject: #i101242# printing from HTML source view --- sw/inc/dbmgr.hxx | 3 - sw/inc/printdata.hxx | 2 +- sw/inc/unotxdoc.hxx | 4 +- sw/inc/viewsh.hxx | 3 +- sw/source/core/view/viewpg.cxx | 4 +- sw/source/core/view/vprint.cxx | 20 +- sw/source/ui/dbui/dbmgr.cxx | 172 -------------- sw/source/ui/inc/srcview.hxx | 8 +- sw/source/ui/uiview/srcview.cxx | 170 ++++++-------- sw/source/ui/uno/unotxdoc.cxx | 482 ++++++++++++++++++++++++---------------- 10 files changed, 390 insertions(+), 478 deletions(-) diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index 9e13058e90e6..51242f33f224 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -252,9 +252,6 @@ public: // Mischen von Datensaetzen in Felder BOOL MergeNew( const SwMergeDescriptor& rMergeDesc ); BOOL Merge(SwWrtShell* pSh); - // Mischen von Datensaetzen in Felder, dann drucken - BOOL MergePrint( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ); // printing parts of a merge result document BOOL MergePrintDocuments( SwView& rView, SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ); diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 14303ad40d5d..345546deabec 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -60,7 +60,7 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper OutputDevice* m_pLast; public: - SwPrintUIOptions( BOOL bWeb = FALSE ); + SwPrintUIOptions( bool bWeb, bool bSwSrcView ); ~SwPrintUIOptions(); bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index e0fa90de0ac7..8e56039cd53e 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -234,9 +234,9 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, void GetNumberFormatter(); // used for XRenderable implementation - SfxViewShell * GuessViewShell( const css::uno::Reference< css::frame::XController > xController = css::uno::Reference< css::frame::XController >() ); + SfxViewShell * GuessViewShell( /* out */ bool &rbIsSwSrcView, const css::uno::Reference< css::frame::XController > xController = css::uno::Reference< css::frame::XController >() ); SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport ); - SfxViewShell * GetRenderView( const SwPrintUIOptions &rOpt, bool bIsPDFExport ); + SfxViewShell * GetRenderView( bool &rbIsSwSrcView, const css::uno::Sequence< css::beans::PropertyValue >& rxOptions, bool bIsPDFExport ); rtl::OUString maBuildId; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 636608279dbb..36da231f1832 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -388,8 +388,7 @@ public: SwDoc * FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt ); //Wird intern fuer die Shell gerufen die Druckt. Formatiert die Seiten. - void CalcPagesForPrint( sal_uInt16 nMax, SfxProgress* pProgress = 0, - const String* pStr = NULL, ULONG nMergeAct = 0, ULONG nMergeCnt = 0 ); + void CalcPagesForPrint( sal_uInt16 nMax, SfxProgress* pProgress = 0 ); //All about fields. void UpdateFlds(sal_Bool bCloseDB = sal_False); diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index c3da2df6cf37..a9ab62df38fc 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -508,7 +508,7 @@ void ViewShell::PrintProspect( } // Seiten fuers Drucken formatieren - aShell.CalcPagesForPrint( nPageMax, 0 /*(USHORT)aPages.Max(), &rProgress*/ ); + aShell.CalcPagesForPrint( nPageMax, 0 ); #endif // TL_NOT_NOW // TLPDF MapMode aMapMode( MAP_TWIP ); @@ -636,7 +636,7 @@ void ViewShell::PrintProspect( { SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( nPageMax /*(USHORT)aPages.Max()*/ ); + CalcPagesForPrint( nPageMax ); } #endif // TL_NOT_NOW // TLPDF pFntCache->Flush(); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 081017f1aeb3..d811c12d02c5 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -369,7 +369,7 @@ void SwRenderData::MakeSwPrtOptions( /*****************************************************************************/ -SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : +SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : m_pLast( NULL ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -378,6 +378,14 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : if( aLocalizedStrings.Count() < 44 ) // bad resource ? return; + // printing HTML sources does not have any valid UI options. + // Its just the source code that gets printed ... + if (bSwSrcView) + { + m_aUIProperties.realloc( 0 ); + return; + } + // create sequence of print UI options // (5 options are not available for Writer-Web) const int nNumProps = bWeb? 17 : 21; @@ -502,12 +510,14 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aHelpText.realloc( 2 ); aHelpText[0] = aLocalizedStrings.GetString( 25 ); aHelpText[1] = aLocalizedStrings.GetString( 25 ); + vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 1, sal_False ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), aChoices, 0, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aAnnotOpt ); // create subsection for Page settings @@ -834,8 +844,7 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, -void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, - const XubString* /*TLPDF pStr*/, ULONG /*TLPDF nMergeAct*/, ULONG /*TLPDF nMergeCnt*/ ) +void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress ) { SET_CURR_SHELL( this ); @@ -1169,8 +1178,7 @@ sal_Bool ViewShell::PrintOrPDFExport( #ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! // benoetigte Seiten fuers Drucken formatieren - pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, 0 /*TLPDFpStr*/, - 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); + pShell->CalcPagesForPrint( (USHORT)nPage, 0 ); // Some field types, can require a valid layout // (expression fields in tables). For these we do an UpdateFlds diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index dee7803a9798..487bc744e9eb 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -781,178 +781,6 @@ SwNewDBMgr::~SwNewDBMgr() } delete pImpl; } -/*-------------------------------------------------------------------- - Beschreibung: Serienbrief drucken - --------------------------------------------------------------------*/ - - -BOOL SwNewDBMgr::MergePrint( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) -{ - SwWrtShell* pSh = &rView.GetWrtShell(); - //check if the doc is synchronized and contains at least one linked section - BOOL bSynchronizedDoc = pSh->IsLabelDoc() && pSh->GetSectionFmtCount() > 1; - //merge source is already open - rOpt.nMergeCnt = 0; - //#i56195# no field update while printing mail merge documents - rOpt.bUpdateFieldsInPrinting = sal_False; - if(pImpl->pMergeData) - { - if(pImpl->pMergeData->aSelection.getLength()) - rOpt.nMergeCnt = pImpl->pMergeData->aSelection.getLength(); - else if(pImpl->pMergeData->xResultSet.is()) - { - sal_Int32 nCount; - if( lcl_getCountFromResultSet( nCount, pImpl->pMergeData->xResultSet ) ) - rOpt.nMergeCnt = (ULONG)nCount; - } - } - - SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); - pModOpt->SetSinglePrintJob(rOpt.IsPrintSingleJobs()); - -//TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); - const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF - vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF - const boost::shared_ptr< vcl::PrinterController > pPrtController( &aPrtAdaptor ); -//TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); -//TLPDF if( rOpt.IsPrintSingleJobs() ) -//TLPDF pPrt->SetEndPrintHdl( Link() ); - -//TLPDF BOOL bUserBreak = FALSE; - BOOL bRet = FALSE; - long nStartRow, nEndRow; - //calculate number of data sets to be printed - - Sequence aViewProperties(16); - PropertyValue* pViewProperties = aViewProperties.getArray(); - pViewProperties[0].Name = C2U("MailMergeCount"); - pViewProperties[0].Value <<= (sal_Int32)rOpt.nMergeCnt; - pViewProperties[1].Name = C2U("PrintGraphics"); - pViewProperties[1].Value <<= (sal_Bool)rOpt.IsPrintGraphic(); - pViewProperties[2].Name = C2U("PrintTables"); - pViewProperties[2].Value <<= (sal_Bool)rOpt.IsPrintTable(); - pViewProperties[3].Name = C2U("PrintDrawings"); - pViewProperties[3].Value <<= (sal_Bool)rOpt.IsPrintDraw(); - pViewProperties[4].Name = C2U("PrintLeftPages"); - pViewProperties[4].Value <<= (sal_Bool)rOpt.IsPrintLeftPage(); - pViewProperties[5].Name = C2U("PrintRightPages"); - pViewProperties[5].Value <<= (sal_Bool)rOpt.IsPrintRightPage(); - pViewProperties[6].Name = C2U("PrintControls"); - pViewProperties[6].Value <<= (sal_Bool)rOpt.IsPrintControl(); - pViewProperties[7].Name = C2U("PrintReversed"); - pViewProperties[7].Value <<= (sal_Bool)rOpt.IsPrintReverse(); - pViewProperties[8].Name = C2U("PrintPaperFromSetup"); - pViewProperties[8].Value <<= (sal_Bool)rOpt.IsPaperFromSetup(); - pViewProperties[9].Name = C2U("PrintFaxName"); - pViewProperties[9].Value <<= rOpt.GetFaxName(); - pViewProperties[10].Name = C2U("PrintAnnotationMode"); - pViewProperties[10].Value <<= (text::NotePrintMode) rOpt.GetPrintPostIts(); - pViewProperties[11].Name = C2U("PrintProspect"); - pViewProperties[11].Value <<= (sal_Bool)rOpt.IsPrintProspect(); - pViewProperties[12].Name = C2U("PrintPageBackground"); - pViewProperties[12].Value <<= (sal_Bool)rOpt.IsPrintPageBackground(); - pViewProperties[13].Name = C2U("PrintBlackFonts"); - pViewProperties[13].Value <<= (sal_Bool)rOpt.IsPrintBlackFont(); - pViewProperties[14].Name = C2U("IsSinglePrintJob"); - pViewProperties[14].Value <<= (sal_Bool)rOpt.IsPrintSingleJobs(); - pViewProperties[15].Name = C2U("PrintEmptyPages"); - pViewProperties[15].Value <<= (sal_Bool)rOpt.IsPrintEmptyPages(); - - rView.SetAdditionalPrintOptions(aViewProperties); - do { - nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; - { - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, pSh->GetView().GetViewFrame()->GetObjectShell())); - pSh->ViewShell::UpdateFlds(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, pSh->GetView().GetViewFrame()->GetObjectShell())); - ++rOpt.nMergeAct; - - // launch MailMergeEvent if required - const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc(); - if (pEvtSrc) - { - uno::Reference< XInterface > xRef( (XMailMergeBroadcaster *) pEvtSrc ); - text::MailMergeEvent aEvt( xRef, rView.GetDocShell()->GetModel() ); - pEvtSrc->LaunchMailMergeEvent( aEvt ); - } - - rView.SfxViewShell::Print( rProgress, bIsAPI ); // ggf Basic-Macro ausfuehren - if( rOpt.IsPrintSingleJobs() && bRet ) - { - //rOpt.bJobStartet = FALSE; - bRet = FALSE; - } - - bMergeLock = TRUE; - if(rOpt.IsPrintProspect()) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - if( ! pPrt->IsJobActive() ) - { - pPrt->SetJobValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); - pPrt->StartJob( rOpt.GetJobName() ); - } - if( pPrt->IsJobActive() ) - { - pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); /* TLPDF */ - bRet = TRUE; - } -#endif // TL_NOT_NOW /*TLPDF*/ -//TLPDFXX pSh->PrintProspectMM( aPrtAdaptor, aViewProperties, rOpt, rOpt.IsPrintProspectRTL() ); // TLPDF - bRet = TRUE; // TLPDF - } - else if( 1 /*TLPDFXX pSh->PrintOrPDFExportMM( aPrtAdaptor, aViewProperties, rOpt ) */ ) - bRet = TRUE; - bMergeLock = FALSE; - -#ifdef TL_NOT_NOW /*TLPDF*/ - if( !pPrt->IsJobActive() ) - { - bUserBreak = TRUE; - bRet = FALSE; - break; - } -#endif // TL_NOT_NOW /*TLPDF*/ - if( !rOpt.IsPrintSingleJobs() ) - { - String& rJNm = (String&)rOpt.GetJobName(); - rJNm.Erase(); - } - } - nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; - } while( bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()); - - if( rOpt.IsPrintSingleJobs() ) - { -//TLPDF SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); -//TLPDF const boost::shared_ptr< Printer > pTmpPrinter( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF -//TLPDF vcl::OldStylePrintAdaptor aPrtAdaptor( pTmpPrinter ); - // TLPDF -//TLPDF pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); -//TLPDF if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? -//TLPDF aSfxSaveLnk.Call( pTmpPrinter ); - } - - rOpt.nMergeCnt = 0; - rOpt.nMergeAct = 0; - - nMergeType = DBMGR_INSERT; - - SwDocShell* pDocSh = rView.GetDocShell(); - SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(pDocSh); - - while (pTmpFrm) // Alle Views Invalidieren - { - SwView *pVw = PTR_CAST(SwView, pTmpFrm->GetViewShell()); - if (pVw) - pVw->GetEditWin().Invalidate(); - pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, pDocSh); - } - - return bRet; -} /*-------------------------------------------------------------------- Beschreibung: Serienbriefe als einzelne Dokumente speichern diff --git a/sw/source/ui/inc/srcview.hxx b/sw/source/ui/inc/srcview.hxx index 996aab82b446..d66096d4418b 100644 --- a/sw/source/ui/inc/srcview.hxx +++ b/sw/source/ui/inc/srcview.hxx @@ -32,6 +32,8 @@ #include #include +#include + #include "srcedtw.hxx" #include "shellid.hxx" @@ -92,11 +94,11 @@ public: void Load(SwDocShell* pDocShell); - virtual USHORT SetPrinter( SfxPrinter* pNew, - USHORT nDiff = SFX_PRINTER_ALL, bool bIsAPI=false ); - virtual ErrCode DoPrint( SfxPrinter *pPrinter, PrintDialog *pPrintDialog, BOOL bSilent, BOOL bIsAPI ); + virtual USHORT SetPrinter( SfxPrinter* pNew, USHORT nDiff = SFX_PRINTER_ALL, bool bIsAPI=false ); virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE ); + sal_Int32 PrintSource( OutputDevice *pOutDev, sal_Int32 nPage, bool bCalcNumPagesOnly ); + void SourceSaved() {bSourceSaved = TRUE;} BOOL HasSourceSaved() const {return bSourceSaved;} diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 1b496b3b4fae..d1e0ab8e3bec 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -151,23 +151,23 @@ TYPEINIT1(SwSrcView, SfxViewShell) --------------------------------------------------*/ -void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle ) +void lcl_PrintHeader( OutputDevice &rOutDev, USHORT nPages, USHORT nCurPage, const String& rTitle ) { short nLeftMargin = LMARGPRN; - Size aSz = pPrinter->GetOutputSize(); + Size aSz = rOutDev.GetOutputSize(); short nBorder = BORDERPRN; - Color aOldFillColor( pPrinter->GetFillColor() ); - Font aOldFont( pPrinter->GetFont() ); + Color aOldFillColor( rOutDev.GetFillColor() ); + Font aOldFont( rOutDev.GetFont() ); - pPrinter->SetFillColor( Color(COL_TRANSPARENT) ); + rOutDev.SetFillColor( Color(COL_TRANSPARENT) ); Font aFont( aOldFont ); aFont.SetWeight( WEIGHT_BOLD ); aFont.SetAlign( ALIGN_BOTTOM ); - pPrinter->SetFont( aFont ); + rOutDev.SetFont( aFont ); - long nFontHeight = pPrinter->GetTextHeight(); + long nFontHeight = rOutDev.GetTextHeight(); // 1.Border => Strich, 2+3 Border = Freiraum. long nYTop = TMARGPRN-3*nBorder-nFontHeight; @@ -175,34 +175,34 @@ void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const S long nXLeft = nLeftMargin-nBorder; long nXRight = aSz.Width()-RMARGPRN+nBorder; - pPrinter->DrawRect( Rectangle( + rOutDev.DrawRect( Rectangle( Point( nXLeft, nYTop ), Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) ); long nY = TMARGPRN-2*nBorder; Point aPos( nLeftMargin, nY ); - pPrinter->DrawText( aPos, rTitle ); + rOutDev.DrawText( aPos, rTitle ); if ( nPages != 1 ) { aFont.SetWeight( WEIGHT_NORMAL ); - pPrinter->SetFont( aFont ); + rOutDev.SetFont( aFont ); String aPageStr( C2S(" [") ); aPageStr += String( SW_RES( STR_PAGE ) ); aPageStr += ' '; aPageStr += String::CreateFromInt32( nCurPage ); aPageStr += ']'; - aPos.X() += pPrinter->GetTextWidth( rTitle ); - pPrinter->DrawText( aPos, aPageStr ); + aPos.X() += rOutDev.GetTextWidth( rTitle ); + rOutDev.DrawText( aPos, aPageStr ); } nY = TMARGPRN-nBorder; - pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) ); + rOutDev.DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) ); - pPrinter->SetFont( aOldFont ); - pPrinter->SetFillColor( aOldFillColor ); + rOutDev.SetFont( aOldFont ); + rOutDev.SetFillColor( aOldFillColor ); } /* -----------------13.11.2003 16:24----------------- @@ -725,9 +725,10 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, return nFound; } -/*-----------------02.07.97 09:29------------------- +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ ---------------------------------------------------*/ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) { SwDocShell* pDocSh = GetDocShell(); @@ -753,114 +754,87 @@ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwSrcView::DoPrint( SfxPrinter * /*pPrinter*/, PrintDialog * /*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) +SfxPrinter* SwSrcView::GetPrinter( BOOL bCreate ) { - #if 0 - SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); - SfxPrinter *pDocPrinter = GetPrinter(TRUE); - if ( !pPrinter ) - pPrinter = pDocPrinter; - else if ( pDocPrinter != pPrinter ) - { - pProgress->RestoreOnEndPrint( pDocPrinter->Clone() ); - SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); - } - pProgress->SetWaitMode(FALSE); + return GetDocShell()->GetDoc()->getPrinter( bCreate ); +} - // Drucker starten - PreparePrint( pDlg ); +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +sal_Int32 SwSrcView::PrintSource( + OutputDevice *pOutDev, + sal_Int32 nPage, + bool bCalcNumPagesOnly ) +{ + if (!pOutDev || nPage <= 0) + return 0; - SfxViewShell::Print(*pProgress, bIsAPI, pDlg ); //??? + //! this a lgorithm for printing the n-th page is very poor since it + //! needs to go over the text of all previous pages to get to the correct one. + //! But since HTML source code is expected to be just a small number of pages + //! even this poor algorithm should be enough... - MapMode eOldMapMode( pPrinter->GetMapMode() ); - Font aOldFont( pPrinter->Printer::GetFont() ); + pOutDev->Push(); TextEngine* pTextEngine = aEditWin.GetTextEngine(); - pPrinter->SetMapMode(MAP_100TH_MM); - Font aFont(aEditWin.GetOutWin()->GetFont()); - Size aSize(aFont.GetSize()); - aSize = aEditWin.GetOutWin()->PixelToLogic(aSize, MAP_100TH_MM); - aFont.SetSize(aSize); - aFont.SetColor(COL_BLACK); - pPrinter->SetFont( aFont ); + pOutDev->SetMapMode( MAP_100TH_MM ); + Font aFont( aEditWin.GetOutWin()->GetFont() ); + Size aSize( aFont.GetSize() ); + aSize = aEditWin.GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM ); + aFont.SetSize( aSize ); + aFont.SetColor( COL_BLACK ); + pOutDev->SetFont( aFont ); String aTitle( GetViewFrame()->GetWindow().GetText() ); - USHORT nLineHeight = (USHORT) pPrinter->GetTextHeight(); // etwas mehr. + USHORT nLineHeight = (USHORT) pOutDev->GetTextHeight(); // etwas mehr. USHORT nParaSpace = 10; - Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.Width() -= (LMARGPRN+RMARGPRN); - aPaperSz.Height() -= (TMARGPRN+BMARGPRN); + Size aPaperSz = pOutDev->GetOutputSize(); + aPaperSz.Width() -= (LMARGPRN + RMARGPRN); + aPaperSz.Height() -= (TMARGPRN + BMARGPRN); // nLinepPage stimmt nicht, wenn Zeilen umgebrochen werden muessen... - USHORT nLinespPage = (USHORT) (aPaperSz.Height()/nLineHeight); - USHORT nCharspLine = (USHORT) (aPaperSz.Width() / pPrinter->GetTextWidth( 'X' )); + USHORT nLinespPage = (USHORT) (aPaperSz.Height() / nLineHeight); + USHORT nCharspLine = (USHORT) (aPaperSz.Width() / pOutDev->GetTextWidth( 'X' )); USHORT nParas = static_cast< USHORT >( pTextEngine->GetParagraphCount() ); - USHORT nPages = (USHORT) (nParas/nLinespPage+1 ); + USHORT nPages = (USHORT) (nParas / nLinespPage + 1 ); USHORT nCurPage = 1; - BOOL bStartJob = pPrinter->StartJob( aTitle ); - if( bStartJob ) + // Header drucken... + if (!bCalcNumPagesOnly && nPage == nCurPage) + lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); + Point aPos( LMARGPRN, TMARGPRN ); + for ( USHORT nPara = 0; nPara < nParas; ++nPara ) { - pPrinter->StartPage(); - // Header drucken... - lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle ); - Point aPos( LMARGPRN, TMARGPRN ); - for ( USHORT nPara = 0; nPara < nParas; nPara++ ) + String aLine( pTextEngine->GetText( nPara ) ); + lcl_ConvertTabsToSpaces( aLine ); + USHORT nLines = aLine.Len() / nCharspLine + 1; + for ( USHORT nLine = 0; nLine < nLines; ++nLine ) { - String aLine( pTextEngine->GetText( nPara ) ); - lcl_ConvertTabsToSpaces( aLine ); - USHORT nLines = aLine.Len()/nCharspLine+1; - for ( USHORT nLine = 0; nLine < nLines; nLine++ ) + String aTmpLine( aLine, nLine * nCharspLine, nCharspLine ); + aPos.Y() += nLineHeight; + if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN ) ) { - String aTmpLine( aLine, nLine*nCharspLine, nCharspLine ); - aPos.Y() += nLineHeight; - if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) ) - { - nCurPage++; - pPrinter->EndPage(); - pPrinter->StartPage(); - lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle ); - aPos = Point( LMARGPRN, TMARGPRN+nLineHeight ); - } - pPrinter->DrawText( aPos, aTmpLine ); + ++nCurPage; + if (!bCalcNumPagesOnly && nPage == nCurPage) + lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); + aPos = Point( LMARGPRN, TMARGPRN + nLineHeight ); } - aPos.Y() += nParaSpace; + if (!bCalcNumPagesOnly && nPage == nCurPage) + pOutDev->DrawText( aPos, aTmpLine ); } - pPrinter->EndPage(); + aPos.Y() += nParaSpace; } - pPrinter->SetFont( aOldFont ); - pPrinter->SetMapMode( eOldMapMode ); - - if ( !bStartJob ) - { - // Printer konnte nicht gestartet werden - delete pProgress; - return ERRCODE_IO_ABORT; - } + pOutDev->Pop(); - pProgress->Stop(); - pProgress->DeleteOnEndPrint(); - pPrinter->EndJob(); - return pPrinter->GetError(); - #else - DBG_ERROR( "dead code" ); - return ERRCODE_IO_NOTSUPPORTED; - #endif + DBG_ASSERT( bCalcNumPagesOnly || nPage <= nCurPage, "page number out of range" ); + return nCurPage; } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - - -SfxPrinter* SwSrcView::GetPrinter( BOOL bCreate ) -{ - return GetDocShell()->GetDoc()->getPrinter( bCreate ); -} /*-------------------------------------------------------------------- Beschreibung: diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index fb765915f5b0..65bc181133e2 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2470,20 +2470,50 @@ static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptio } -SfxViewShell * SwXTextDocument::GetRenderView( const SwPrintUIOptions &rOpt, bool bIsPDFExport ) +static bool lcl_SeqHasProperty( + const uno::Sequence< beans::PropertyValue >& rOptions, + const sal_Char *pPropName ) +{ + bool bRes = false; + const sal_Int32 nLen = rOptions.getLength(); + const beans::PropertyValue *pProps = rOptions.getConstArray(); + for (sal_Int32 i = 0; i < nLen && !bRes; ++i) + { + if (pProps[i].Name.equalsAscii( pPropName )) + bRes = true; + } + return bRes; +} + + +SfxViewShell * SwXTextDocument::GetRenderView( + bool &rbIsSwSrcView, + const uno::Sequence< beans::PropertyValue >& rOptions, + bool bIsPDFExport ) { // get view shell to use SfxViewShell *pView = 0; if (bIsPDFExport) - pView = GuessViewShell(); + pView = GuessViewShell( rbIsSwSrcView ); else { - uno::Any aTmp( rOpt.getValue( C2U( "View" ) )); + uno::Any aTmp; + const sal_Int32 nLen = rOptions.getLength(); + const beans::PropertyValue *pProps = rOptions.getConstArray(); + for (sal_Int32 i = 0; i < nLen; ++i) + { + if (pProps[i].Name.equalsAscii( "View" )) + { + aTmp = pProps[i].Value; + break; + } + } + uno::Reference< frame::XController > xController; if (aTmp >>= xController) { DBG_ASSERT( xController.is(), "controller is empty!" ); - pView = GuessViewShell( xController ); + pView = GuessViewShell( rbIsSwSrcView, xController ); } } return pView; @@ -2499,7 +2529,10 @@ SfxViewShell * SwXTextDocument::GetRenderView( const SwPrintUIOptions &rOpt, boo * SfxViewShell. */ -SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rSelection, bool bIsPDFExport ) +SwDoc * SwXTextDocument::GetRenderDoc( + SfxViewShell *&rpView, + const uno::Any& rSelection, + bool bIsPDFExport ) { SwDoc *pDoc = 0; @@ -2518,8 +2551,9 @@ SwDoc * SwXTextDocument::GetRenderDoc( SfxViewShell *&rpView, const uno::Any& rS // used for PDF export of (multi-)selection if (rSelection.hasValue()) // is anything selected ? { + bool bIsSwSrcView = false; if (!rpView) - rpView = GuessViewShell(); + rpView = GuessViewShell( bIsSwSrcView ); DBG_ASSERT( rpView, "ViewShell missing" ); // the view shell should be SwView for documents PDF export. // for the page preview no selection should be possible @@ -2554,106 +2588,111 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); - // actually m_pRenderData and m_pPrintUIOptions should have already been - // destroyed in 'render' when IsLastPage was set (or should have been set) -// if (m_pRenderData) -// delete m_pRenderData, m_pRenderData = 0; -// if (m_pPrintUIOptions) -// delete m_pPrintUIOptions, m_pPrintUIOptions = 0; + const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); + bool bIsSwSrcView = false; + SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); if (! m_pRenderData) m_pRenderData = new SwRenderData; if (! m_pPrintUIOptions) { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); } bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - SfxViewShell *pView = GetRenderView( *m_pPrintUIOptions, bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); + DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); if (!pDoc || !pView) - throw RuntimeException(); - - SwDocShell *pRenderDocShell = pDoc->GetDocShell(); - // #i38289 - if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE) /*TLPDF for printing as well?*/) - { - pRenderDocShell->ToggleBrowserMode(false,NULL); - } - - SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell(); + return 0; sal_Int32 nRet = 0; - if( !pWrtShell ) + if (bIsSwSrcView) { - //create a hidden view to be able to export as PDF also in print preview - m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE ); - SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell(); - pWrtShell = pSwView->GetWrtShellPtr(); + SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); + OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + nRet = pSwSrcView->PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ ); } + else + { + SwDocShell *pRenderDocShell = pDoc->GetDocShell(); + // #i38289 + if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE)) + { + pRenderDocShell->ToggleBrowserMode(false,NULL); + } - m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); - m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, - m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); + SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell(); - //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); - const TypeId aSwViewTypeId = TYPE(SwView); - if (pView->IsA(aSwViewTypeId)) - m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr() ); + if( !pWrtShell ) + { + //create a hidden view to be able to export as PDF also in print preview + m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE ); + SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell(); + pWrtShell = pSwView->GetWrtShellPtr(); + } - if( bFormat ) - { - // since printing now also use the API for PDF export this option - // should be set for printing as well ... - pWrtShell->SetPDFExportOption( sal_True ); + m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); + m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, + m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); - // --> FME 2005-05-23 #122919# Force field update before PDF export: - pWrtShell->ViewShell::UpdateFlds(TRUE); - // <-- + //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); + const TypeId aSwViewTypeId = TYPE(SwView); + if (pView->IsA(aSwViewTypeId)) + m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr() ); - // there is some redundancy between those two fucntion calls, but right now - // there is no time to sort this out. - //TODO: check what exatly needs to be done and make just one function for that - pWrtShell->CalcLayout(); - pWrtShell->CalcPagesForPrint( pDoc->GetPageCount() ); + if( bFormat ) + { + // since printing now also use the API for PDF export this option + // should be set for printing as well ... + pWrtShell->SetPDFExportOption( sal_True ); - pWrtShell->SetPDFExportOption( sal_False ); - } + // --> FME 2005-05-23 #122919# Force field update before PDF export: + pWrtShell->ViewShell::UpdateFlds(TRUE); + // <-- - const sal_Int32 nPageCount = pDoc->GetPageCount(); + // there is some redundancy between those two function calls, but right now + // there is no time to sort this out. + //TODO: check what exatly needs to be done and make just one function for that + pWrtShell->CalcLayout(); + pWrtShell->CalcPagesForPrint( pDoc->GetPageCount() ); - // - // get number of pages to be rendered - // - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); - if (bPrintProspect) - { - pDoc->CalculatePagePairsForProspectPrinting( *m_pRenderData, *m_pPrintUIOptions, nPageCount ); - nRet = m_pRenderData->GetPagePairsForProspectPrinting().size(); - } - else - { - const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); - if (nPostItMode != POSTITS_NONE) - { - OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); - m_pRenderData->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev ); + pWrtShell->SetPDFExportOption( sal_False ); } - // get set of valid document pages (according to the current settings) - // and their start frames - pDoc->CalculatePagesForPrinting( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); + const sal_Int32 nPageCount = pDoc->GetPageCount(); - if (nPostItMode != POSTITS_NONE) + // + // get number of pages to be rendered + // + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); + if (bPrintProspect) { - pDoc->UpdatePagesForPrintingWithPostItData( *m_pRenderData, - *m_pPrintUIOptions, bIsPDFExport, nPageCount ); + pDoc->CalculatePagePairsForProspectPrinting( *m_pRenderData, *m_pPrintUIOptions, nPageCount ); + nRet = m_pRenderData->GetPagePairsForProspectPrinting().size(); } + else + { + const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); + if (nPostItMode != POSTITS_NONE) + { + OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + m_pRenderData->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev ); + } - nRet = m_pRenderData->GetPagesToPrint().size(); + // get set of valid document pages (according to the current settings) + // and their start frames + pDoc->CalculatePagesForPrinting( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); + + if (nPostItMode != POSTITS_NONE) + { + pDoc->UpdatePagesForPrintingWithPostItData( *m_pRenderData, + *m_pPrintUIOptions, bIsPDFExport, nPageCount ); + } + + nRet = m_pRenderData->GetPagesToPrint().size(); + } } DBG_ASSERT( nRet >= 0, "negative number of pages???" ); @@ -2672,44 +2711,83 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if(!IsValid()) throw RuntimeException(); - DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." ); - DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." ); + const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); + bool bIsSwSrcView = false; + SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); + + // m_pRenderData should NOT be created here! + // That should only be done in getRendererCount. If this function is called before + // getRendererCount was called then the caller will probably just retrieve the extra UI options + // and is not interested in getting valid information about the other data that would + // otherwise be provided here! // if( ! m_pRenderData ) // m_pRenderData = new SwRenderData; if( ! m_pPrintUIOptions ) { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); - SfxViewShell *pView = GetRenderView( *m_pPrintUIOptions, bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); + DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); if (!pDoc || !pView) - throw RuntimeException(); + return uno::Sequence< beans::PropertyValue >(); // due to #110067# (document page count changes sometimes during // PDF export/printing) we can not check for the upper bound properly. // Thus instead of throwing the exception we silently return. - if (!(0 <= nRenderer /* && nRenderer < pDoc->GetPageCount()*/)) - throw IllegalArgumentException(); - if (nRenderer >= pDoc->GetPageCount()) - return uno::Sequence< beans::PropertyValue >(); + if (0 > nRenderer) + throw IllegalArgumentException(); + sal_Int32 nMaxRenderer = 0; + if (!bIsSwSrcView && m_pRenderData) + { + DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); + nMaxRenderer = bPrintProspect? + m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : + m_pRenderData->GetPagesToPrint().size() - 1; + } + // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print + // we obmit checking of the upper bound in this case. + if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer) + return uno::Sequence< beans::PropertyValue >(); + + uno::Sequence< beans::PropertyValue > aRenderer; + if (m_pRenderData) + { + Size aPgSize; + if (bIsSwSrcView || m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False )) + { + // for printing of HTML source code and prospect printing we should use + // the printers paper size since + // a) HTML source view has no page size + // b) prospect printing has a different page size from the documents page + // since two document pages will get rendered on one printer page + + // since PageIncludesNonprintableArea will be set to true we can return the + // printers paper size here. + // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this + // case we won't get an OutputDevice here, but then the caller also has no need + // for the correct PageSisze right now... + Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); + if (pPrinter) + aPgSize = pPrinter->GetPaperSize(); + } + else + { + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); + aPgSize = pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ); + } + awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), + TWIP_TO_MM100( aPgSize.Height() )); - bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ) ); - awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), - TWIP_TO_MM100( aPgSize.Height() )); - // prospect printing should be landscape, thus switching width and height - if (m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False ) && - aPageSize.Height > aPageSize.Width) - aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); - uno::Sequence< beans::PropertyValue > aRenderer(2); - aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); - aRenderer[0].Value <<= aPageSize; - aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); - aRenderer[1].Value <<= sal_True; + aRenderer.realloc(2); + aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); + aRenderer[0].Value <<= aPageSize; + aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); + aRenderer[1].Value <<= sal_True; + } m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); @@ -2719,6 +2797,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( ---------------------------------------------------------------------------*/ SfxViewShell * SwXTextDocument::GuessViewShell( + /* out */ bool &rbIsSwSrcView, const uno::Reference< css::frame::XController > xController ) { // #130810# SfxViewShell::Current() / SfxViewShell::GetObjectShell() @@ -2727,6 +2806,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell( SfxViewShell *pView = 0; SwView *pSwView = 0; SwPagePreView *pSwPagePreView = 0; + SwSrcView *pSwSrcView = 0; SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False ); // look for the view shell with the same controller in use, @@ -2736,6 +2816,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell( { pView = pFrame->GetViewShell(); pSwView = dynamic_cast< SwView * >(pView); + pSwSrcView = dynamic_cast< SwSrcView * >(pView); if (!pSwPagePreView) pSwPagePreView = dynamic_cast< SwPagePreView * >(pView); if (xController.is()) @@ -2743,15 +2824,18 @@ SfxViewShell * SwXTextDocument::GuessViewShell( if (pView && pView->GetController() == xController) break; } - else if (pSwView) + else if (pSwView || pSwSrcView) break; pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); } - DBG_ASSERT( pSwView || pSwPagePreView, "failed to get view shell" ); - return pSwView ? - dynamic_cast< SfxViewShell * >(pSwView) : - dynamic_cast< SfxViewShell * >(pSwPagePreView); + DBG_ASSERT( pSwView || pSwPagePreView || pSwSrcView, "failed to get view shell" ); + if (pView) + rbIsSwSrcView = pSwSrcView != 0; + return pView; +// return pSwView ? dynamic_cast< SfxViewShell * >(pSwView) : +// (pSwSrcView ? dynamic_cast< SfxViewShell * >(pSwSrcView) : +// dynamic_cast< SfxViewShell * >(pSwPagePreView) ); } @@ -2765,120 +2849,140 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); + const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); + bool bIsSwSrcView = false; + SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); + DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." ); DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." ); if (!m_pRenderData) m_pRenderData = new SwRenderData; if (!m_pPrintUIOptions) { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); + m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); } m_pPrintUIOptions->processProperties( rxOptions ); const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); - SfxViewShell *pView = GetRenderView( *m_pPrintUIOptions, bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); - + DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); if (!pDoc || !pView) - throw RuntimeException(); + return; // due to #110067# (document page count changes sometimes during // PDF export/printing) we can not check for the upper bound properly. // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if ( (bPrintProspect && size_t(nRenderer) >= m_pRenderData->GetPagePairsForProspectPrinting().size()) - || (!bPrintProspect && size_t(nRenderer) >= m_pRenderData->GetPagesToPrint().size())) - return; - - // the view shell should be SwView for documents PDF export - // or SwPagePreView for PDF export of the page preview - //!! (check for SwView first as in GuessViewShell) !! - DBG_ASSERT( pView, "!! view missing !!" ); - const TypeId aSwViewTypeId = TYPE(SwView); - ViewShell* pVwSh = 0; - if (pView) - { - pVwSh = pView->IsA(aSwViewTypeId) ? - ((SwView*)pView)->GetWrtShellPtr() : - ((SwPagePreView*)pView)->GetViewShell(); + sal_Int32 nMaxRenderer = 0; + if (!bIsSwSrcView) + { + DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); + nMaxRenderer = bPrintProspect? + m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : + m_pRenderData->GetPagesToPrint().size() - 1; + } + // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print + // we obmit checking of the upper bound in this case. + if (!bIsSwSrcView && nRenderer > nMaxRenderer) + return; + + if (bIsSwSrcView) + { + SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); + OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + pSwSrcView->PrintSource( pOutDev, nRenderer + 1, false ); } - - // get output device to use - OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); - - if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) + else { - const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); - const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); - const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); - bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - - DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) - || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), - "SwView / SwViewOptionAdjust_Impl availability mismatch" ); - - // since printing now also use the API for PDF export this option - // should be set for printing as well ... - pVwSh->SetPDFExportOption( sal_True ); - - // --> FME 2004-06-08 #i12836# enhanced pdf export - // - // First, we have to export hyperlinks, notes, and outline to pdf. - // During this process, additional information required for tagging - // the pdf file are collected, which are evaulated during painting. - // - SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ? - ((SwView*)pView)->GetWrtShellPtr() : - 0; - - if (bIsPDFExport && bFirstPage && pWrtShell) + // the view shell should be SwView for documents PDF export + // or SwPagePreView for PDF export of the page preview + //!! (check for SwView first as in GuessViewShell) !! + DBG_ASSERT( pView, "!! view missing !!" ); + const TypeId aSwViewTypeId = TYPE(SwView); + ViewShell* pVwSh = 0; + if (pView) { - SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); + pVwSh = pView->IsA(aSwViewTypeId) ? + ((SwView*)pView)->GetWrtShellPtr() : + ((SwPagePreView*)pView)->GetViewShell(); } - // <-- - const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions(); - if (bPrintProspect) - pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); - else // normal printing and PDF export - pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer, bIsPDFExport ); + // get output device to use + OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); - // --> FME 2004-10-08 #i35176# - // - // After printing the last page, we take care for the links coming - // from the EditEngine. The links are generated during the painting - // process, but the destinations are still missing. - // - if (bIsPDFExport && bLastPage && pWrtShell) + if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) { - SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); - } - // <-- + const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); + const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); + const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - pVwSh->SetPDFExportOption( sal_False ); + DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) + || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), + "SwView / SwViewOptionAdjust_Impl availability mismatch" ); - // last page to be rendered? (not necessarily the last page of the document) - // -> do clean-up of data - if (bLastPage) - { - // #i96167# haggai: delete pViewOptionsAdjust here because it makes use - // of the shell, which might get destroyed in lcl_DisposeView! - if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) - m_pRenderData->ViewOptionAdjustStop(); + // since printing now also use the API for PDF export this option + // should be set for printing as well ... + pVwSh->SetPDFExportOption( sal_True ); - if (m_pRenderData && m_pRenderData->HasPostItData()) - m_pRenderData->DeletePostItData(); - if (m_pHiddenViewFrame) + // --> FME 2004-06-08 #i12836# enhanced pdf export + // + // First, we have to export hyperlinks, notes, and outline to pdf. + // During this process, additional information required for tagging + // the pdf file are collected, which are evaulated during painting. + // + SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ? + ((SwView*)pView)->GetWrtShellPtr() : + 0; + + if (bIsPDFExport && bFirstPage && pWrtShell) + { + SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); + } + // <-- + + const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions(); + if (bPrintProspect) + pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); + else // normal printing and PDF export + pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer, bIsPDFExport ); + + // --> FME 2004-10-08 #i35176# + // + // After printing the last page, we take care for the links coming + // from the EditEngine. The links are generated during the painting + // process, but the destinations are still missing. + // + if (bIsPDFExport && bLastPage && pWrtShell) { - lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); - m_pHiddenViewFrame = 0; + SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); } + // <-- - delete m_pRenderData; m_pRenderData = NULL; - delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; + pVwSh->SetPDFExportOption( sal_False ); + + // last page to be rendered? (not necessarily the last page of the document) + // -> do clean-up of data + if (bLastPage) + { + // #i96167# haggai: delete pViewOptionsAdjust here because it makes use + // of the shell, which might get destroyed in lcl_DisposeView! + if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) + m_pRenderData->ViewOptionAdjustStop(); + + if (m_pRenderData && m_pRenderData->HasPostItData()) + m_pRenderData->DeletePostItData(); + if (m_pHiddenViewFrame) + { + lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); + m_pHiddenViewFrame = 0; + } + + delete m_pRenderData; m_pRenderData = NULL; + delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; + } } } } -- cgit v1.2.3 From c746ad70065a31b1ef8147dc198dbe96b8ea60c7 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 4 Sep 2009 07:52:16 +0000 Subject: #i101242# don't create SwRenderData for printing from the HTML source view; will crash on second execute of print direct --- sw/source/ui/uno/unotxdoc.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 65bc181133e2..d6a9aa4326a8 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2592,9 +2592,9 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( bool bIsSwSrcView = false; SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); - if (! m_pRenderData) + if (!bIsSwSrcView && !m_pRenderData) m_pRenderData = new SwRenderData; - if (! m_pPrintUIOptions) + if (!m_pPrintUIOptions) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); @@ -2855,7 +2855,7 @@ void SAL_CALL SwXTextDocument::render( DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." ); DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." ); - if (!m_pRenderData) + if (!bIsSwSrcView && !m_pRenderData) m_pRenderData = new SwRenderData; if (!m_pPrintUIOptions) { -- cgit v1.2.3 From aacdff37a8696ddcbe0094e7b3fcd650eb311eb5 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 4 Sep 2009 09:03:29 +0000 Subject: #i101242# printing of HTML source won't cross the border frame anymore --- sw/source/ui/uiview/srcview.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index d1e0ab8e3bec..a36c4b553128 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -806,7 +806,8 @@ sal_Int32 SwSrcView::PrintSource( // Header drucken... if (!bCalcNumPagesOnly && nPage == nCurPage) lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); - Point aPos( LMARGPRN, TMARGPRN ); + const Point aStartPos( LMARGPRN, TMARGPRN ); + Point aPos( aStartPos ); for ( USHORT nPara = 0; nPara < nParas; ++nPara ) { String aLine( pTextEngine->GetText( nPara ) ); @@ -816,12 +817,12 @@ sal_Int32 SwSrcView::PrintSource( { String aTmpLine( aLine, nLine * nCharspLine, nCharspLine ); aPos.Y() += nLineHeight; - if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN ) ) + if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN - nLineHeight/2 ) ) { ++nCurPage; if (!bCalcNumPagesOnly && nPage == nCurPage) lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); - aPos = Point( LMARGPRN, TMARGPRN + nLineHeight ); + aPos = aStartPos; } if (!bCalcNumPagesOnly && nPage == nCurPage) pOutDev->DrawText( aPos, aTmpLine ); -- cgit v1.2.3 From 3450d32cff473715e2a7d5a44e5cefde6a4a1872 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 4 Sep 2009 10:12:00 +0000 Subject: #i101242# assertion in ViewOptionAdjustStart fixed --- sw/source/core/view/viewpg.cxx | 2 +- sw/source/core/view/vprint.cxx | 5 +++-- sw/source/ui/uno/unotxdoc.cxx | 43 +++++++++++++++++++++--------------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index a9ab62df38fc..f15284839682 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -465,7 +465,7 @@ void ViewShell::PrintProspect( { const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagePairsForProspectPrinting().size() - 1; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < nMaxRenderer, "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer <= nMaxRenderer, "nRenderer out of bounds"); #endif Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); if (!pPrinter || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index d811c12d02c5..8cb7f7874a79 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -294,7 +294,8 @@ void SwRenderData::DeletePostItData() void SwRenderData::ViewOptionAdjustStart( SwWrtShell& rSh ) { - DBG_ASSERT( !m_pViewOptionAdjust, "m_pViewOptionAdjust already exists" ); + if (m_pViewOptionAdjust) + delete m_pViewOptionAdjust; m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh ); } @@ -1088,7 +1089,7 @@ sal_Bool ViewShell::PrintOrPDFExport( const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagesToPrint().size() - 1; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < nMaxRenderer, "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer <= nMaxRenderer, "nRenderer out of bounds"); #endif if (!pOutDev || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer) return sal_False; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index d6a9aa4326a8..f9fff177a788 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2617,33 +2617,32 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( else { SwDocShell *pRenderDocShell = pDoc->GetDocShell(); - // #i38289 - if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE)) - { - pRenderDocShell->ToggleBrowserMode(false,NULL); - } - SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell(); - - if( !pWrtShell ) + if (bFormat) { - //create a hidden view to be able to export as PDF also in print preview - m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE ); - SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell(); - pWrtShell = pSwView->GetWrtShellPtr(); - } + // #i38289 + if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE)) + { + pRenderDocShell->ToggleBrowserMode(false,NULL); + } - m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); - m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, - m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); + if (!pWrtShell) + { + //create a hidden view to be able to export as PDF also in print preview + m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE ); + SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell(); + pWrtShell = pSwView->GetWrtShellPtr(); + } - //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); - const TypeId aSwViewTypeId = TYPE(SwView); - if (pView->IsA(aSwViewTypeId)) - m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr() ); + m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); + m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, + m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); + + //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); + const TypeId aSwViewTypeId = TYPE(SwView); + if (pView->IsA(aSwViewTypeId)) + m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr() ); - if( bFormat ) - { // since printing now also use the API for PDF export this option // should be set for printing as well ... pWrtShell->SetPDFExportOption( sal_True ); -- cgit v1.2.3 From 4f2690960ace7b79ef45b07f3fb81a208d97636a Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 4 Sep 2009 14:41:56 +0000 Subject: #i101242# clean-up --- sw/inc/printdata.hxx | 46 ++--- sw/inc/swprtopt.hxx | 3 +- sw/inc/viewsh.hxx | 10 +- sw/source/core/doc/doc.cxx | 13 +- sw/source/core/view/viewpg.cxx | 374 +---------------------------------------- sw/source/core/view/vnew.cxx | 7 - sw/source/core/view/vprint.cxx | 141 ++++------------ sw/source/ui/inc/pview.hxx | 2 - sw/source/ui/uiview/pview.cxx | 16 +- sw/source/ui/uiview/view.cxx | 44 +---- sw/source/ui/uno/unotxdoc.cxx | 2 +- 11 files changed, 72 insertions(+), 586 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 345546deabec..17b9e3cefc9a 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -211,11 +211,11 @@ public: bPaperFromSetup = bPrintReverse = bPrintProspect = - bPrintProspectRTL = + bPrintProspectRTL = bPrintSingleJobs = bModified = bPrintBlackFont = - bPrintHiddenText = + bPrintHiddenText = bPrintTextPlaceholder = sal_False; nPrintPostIts = 0; @@ -226,24 +226,24 @@ public: sal_Bool operator==(const SwPrintData& rData)const { return - bPrintGraphic == rData.bPrintGraphic && - bPrintTable == rData.bPrintTable && - bPrintDraw == rData.bPrintDraw && - bPrintControl == rData.bPrintControl && - bPrintPageBackground== rData.bPrintPageBackground&& - bPrintBlackFont == rData.bPrintBlackFont && - bPrintLeftPages == rData.bPrintLeftPages && - bPrintRightPages == rData.bPrintRightPages && - bPrintReverse == rData.bPrintReverse && - bPrintProspect == rData.bPrintProspect && - bPrintProspectRTL == rData.bPrintProspectRTL && - bPrintSingleJobs == rData.bPrintSingleJobs && - bPaperFromSetup == rData.bPaperFromSetup && - bPrintEmptyPages == rData.bPrintEmptyPages && + bPrintGraphic == rData.bPrintGraphic && + bPrintTable == rData.bPrintTable && + bPrintDraw == rData.bPrintDraw && + bPrintControl == rData.bPrintControl && + bPrintPageBackground== rData.bPrintPageBackground && + bPrintBlackFont == rData.bPrintBlackFont && + bPrintLeftPages == rData.bPrintLeftPages && + bPrintRightPages == rData.bPrintRightPages && + bPrintReverse == rData.bPrintReverse && + bPrintProspect == rData.bPrintProspect && + bPrintProspectRTL == rData.bPrintProspectRTL && + bPrintSingleJobs == rData.bPrintSingleJobs && + bPaperFromSetup == rData.bPaperFromSetup && + bPrintEmptyPages == rData.bPrintEmptyPages && bUpdateFieldsInPrinting == rData.bUpdateFieldsInPrinting && - nPrintPostIts == rData.nPrintPostIts && - sFaxName == rData.sFaxName && - bPrintHiddenText == rData.bPrintHiddenText && + nPrintPostIts == rData.nPrintPostIts && + sFaxName == rData.sFaxName && + bPrintHiddenText == rData.bPrintHiddenText && bPrintTextPlaceholder == rData.bPrintTextPlaceholder; } @@ -266,12 +266,12 @@ public: sal_Bool IsPrintProspect() const { return bPrintProspect; } sal_Bool IsPrintProspectRTL() const { return bPrintProspectRTL; } sal_Bool IsPrintPageBackground() const { return bPrintPageBackground; } - sal_Bool IsPrintBlackFont() const { return bPrintBlackFont;} - sal_Bool IsPrintSingleJobs() const { return bPrintSingleJobs;} + sal_Bool IsPrintBlackFont() const { return bPrintBlackFont; } + sal_Bool IsPrintSingleJobs() const { return bPrintSingleJobs; } sal_Int16 GetPrintPostIts() const { return nPrintPostIts; } - const rtl::OUString GetFaxName() const{return sFaxName;} + const rtl::OUString GetFaxName() const{return sFaxName; } sal_Bool IsPrintHiddenText() const {return bPrintHiddenText;} - sal_Bool IsPrintTextPlaceholder() const {return bPrintTextPlaceholder;} + sal_Bool IsPrintTextPlaceholder() const {return bPrintTextPlaceholder; } void SetPrintGraphic ( sal_Bool b ) { doSetModified(); bPrintGraphic = b;} void SetPrintTable ( sal_Bool b ) { doSetModified(); bPrintTable = b;} diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index 76930675eb6c..dbf2898c481e 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -95,8 +95,7 @@ public: } // get print options - void MakeOptions( PrintDialog* pDlg, - BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, SfxPrinter* pPrt, SwPrintData* pData ); + void MakeOptions( BOOL bWeb ); }; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 36da231f1832..03d1c9d64184 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -372,8 +372,7 @@ public: // printing of one page. // bIsPDFExport == true is: do PDF Export (no printing!) sal_Bool PrintOrPDFExport( OutputDevice *pOutDev, const SwPrtOptions &rPrintData, - sal_Int32 nRenderer, /* offset in vector of pages to print */ - bool bIsPDFExport = sal_False ); + sal_Int32 nRenderer /* offset in vector of pages to print */ ); // printing of one brochure page void PrintProspect( OutputDevice *pOutDev, const SwPrintData &rPrintData, @@ -384,7 +383,7 @@ public: OutputDevice* pOleOut, const Rectangle& rRect ); // creates temporary doc with selected text for PDF export - SwDoc * CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef& ); + SwDoc * CreatePrtDoc( SfxObjectShellRef& ); SwDoc * FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt ); //Wird intern fuer die Shell gerufen die Druckt. Formatiert die Seiten. @@ -487,11 +486,6 @@ public: */ void AdjustOptionsForPagePreview( const SwPrtOptions &_rPrintOptions ); - // print page/print preview - void PrintPreViewPage( SwPrtOptions& rOptions, sal_uInt16 nRowCol, - SfxProgress& rProgress, - const SwPagePreViewPrtData* = 0 ); - sal_Bool IsViewLocked() const { return bViewLocked; } void LockView( sal_Bool b ) { bViewLocked = b; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2c125bcb98e4..4aabbc29b693 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1011,7 +1011,6 @@ struct _PostItFld : public _SetGetExpFld USHORT GetPageNo( const StringRangeEnumerator &rRangeEnum, const std::set< sal_Int32 > &rPossiblePages, - BOOL bRgt, BOOL bLft, USHORT& rVirtPgNo, USHORT& rLineNo ); SwPostItField* GetPostIt() const @@ -1024,7 +1023,6 @@ struct _PostItFld : public _SetGetExpFld USHORT _PostItFld::GetPageNo( const StringRangeEnumerator &rRangeEnum, const std::set< sal_Int32 > &rPossiblePages, - BOOL bRgt, BOOL bLft, /* TLPDF both should not be needed since rMulti should only include the correct pages as stored in GetValidPagesSet */ /* out */ USHORT& rVirtPgNo, /* out */ USHORT& rLineNo ) { //Problem: Wenn ein PostItFld in einem Node steht, der von mehr als @@ -1044,8 +1042,7 @@ USHORT _PostItFld::GetPageNo( continue; USHORT nPgNo = pFrm->GetPhyPageNum(); BOOL bRight = pFrm->OnRightPage(); - if( rRangeEnum.hasValue( nPgNo, &rPossiblePages ) && - ( (bRight && bRgt) || (!bRight && bLft) ) ) + if( rRangeEnum.hasValue( nPgNo, &rPossiblePages )) { rLineNo = (USHORT)(pFrm->GetLineCount( nPos ) + pFrm->GetAllLines() - pFrm->GetThisLines()); @@ -1255,7 +1252,7 @@ void SwDoc::CalculatePagesForPrinting( OUString aPageRange; if (bIsPDFExport) { -// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); + // ?? rOptions.getValue( C2U("Selection") ); aPageRange = rOptions.getStringValue( "PageRange", OUString() ); } else @@ -1325,8 +1322,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( _PostItFld& rPostIt = (_PostItFld&)*(*rData.m_pPostItFields)[ i ]; nLastPageNum = nPhyPageNum; nPhyPageNum = rPostIt.GetPageNo( - aRangeEnum, rData.GetValidPagesSet(), - true /*TLPDF bRgt*/, true /*TLPDF bLft*/, nVirtPg, nLineNo ); + aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo ); if (nPhyPageNum) { // need to insert a page break? @@ -1515,9 +1511,6 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // of the prospect! bool bPrintLeftPages = rOptions.IsPrintLeftPages(); bool bPrintRightPages = rOptions.IsPrintRightPages(); - // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now -//TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); bool bPrintProspectRTL = rOptions.getIntValue( "PrintProspectRTL", 0 ) ? true : false; // get pages for prospect printing according to the 'PageRange' diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index f15284839682..379f8b42d0c5 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -93,366 +93,6 @@ void ViewShell::AdjustOptionsForPagePreview( const SwPrtOptions &_rPrintOptions return; } -// output print preview on printer -// OD 05.05.2003 #i14016# - consider empty pages on calculation of scaling -// and on calculation of paint offset. -void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, - USHORT nRowCol, SfxProgress& rProgress, - const SwPagePreViewPrtData* pPrtData ) -{ - if( !rOptions.aMulti.GetSelectCount() ) - return; - - // wenn kein Drucker vorhanden ist, wird nicht gedruckt - SfxPrinter* pPrt = getIDocumentDeviceAccess()->getPrinter(false); - if( !pPrt || !pPrt->GetName().Len() ) - return; - -// schoen waers gewesen !!! const MultiSelection& rMulti = rOptions.aMulti; - MultiSelection aMulti( rOptions.aMulti ); - Range aPages( aMulti.FirstSelected(), aMulti.LastSelected() ); - if ( aPages.Max() > USHRT_MAX ) - aPages.Max() = USHRT_MAX; - - ASSERT( aPages.Min() > 0, - "Seite 0 Drucken?" ); - ASSERT( aPages.Min() <= aPages.Max(), - "MinSeite groesser MaxSeite." ); - - // eine neue Shell fuer den Printer erzeugen - ViewShell aShell( *this, 0 ); - if ( &GetRefDev() == pPrt ) - aShell.mpTmpRef = new SfxPrinter( *pPrt ); - - SET_CURR_SHELL( &aShell ); - - aShell.PrepareForPrint( rOptions ); - - // gibt es versteckte Absatzfelder, unnoetig wenn die Absaetze bereits - // ausgeblendet sind. - int bHiddenFlds = FALSE; - SwFieldType* pFldType = 0; - if ( GetViewOptions()->IsShowHiddenPara() ) - { - pFldType = getIDocumentFieldsAccess()->GetSysFldType( RES_HIDDENPARAFLD ); - bHiddenFlds = 0 != pFldType->GetDepends(); - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - } - } - - // Seiten fuers Drucken formatieren - aShell.CalcPagesForPrint( (USHORT)aPages.Max(), &rProgress ); - - USHORT nCopyCnt = rOptions.bCollate ? rOptions.nCopyCount : 1; - BOOL bStartJob = FALSE; - - const bool bPrintEmptyPages = rOptions.IsPrintEmptyPages(); - - for ( USHORT nCnt = 0; nCnt < nCopyCnt; nCnt++ ) - { - if( rOptions.IsPrintSingleJobs() && rOptions.GetJobName().Len() && - ( bStartJob || rOptions.bJobStartet ) ) - { -#ifdef TL_NOT_NOW /*TLPDF*/ - pPrt->EndJob(); -#endif - rOptions.bJobStartet = TRUE; - - // Reschedule statt Yield, da Yield keine Events abarbeitet - // und es sonst eine Endlosschleife gibt. - while( pPrt->IsPrinting() ) - rProgress.Reschedule(); - - rOptions.MakeNextJobName(); -#ifdef TL_NOT_NOW /*TLPDF*/ - // bStartJob = pPrt->StartJob( rOptions.GetJobName() ); -#endif - } - - const SwPageFrm *pStPage = (SwPageFrm*)GetLayout()->Lower(); - const SwFrm *pEndPage = pStPage; - USHORT i; - - for( i = 1; pStPage && i < (USHORT)aPages.Min(); ++i ) - pStPage = (SwPageFrm*)pStPage->GetNext(); - - if( !pStPage ) // dann wars das - { - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( (USHORT)aPages.Max() ); - } - return; - } - - // unsere SttPage haben wir, dann die EndPage suchen - USHORT nFirstPageNo = i; - USHORT nLastPageNo = i; - USHORT nPageNo = 1; - - pEndPage = pStPage; - - if( pStPage->GetNext() && (i != (USHORT)aPages.Max()) ) - { - pEndPage = pEndPage->GetNext(); - for( ++i,++nLastPageNo; - pEndPage->GetNext() && i < (USHORT)aPages.Max(); ++i ) - { - pEndPage = pEndPage->GetNext(); - ++nLastPageNo; - } - } - - if( rOptions.bPrintReverse ) - { - const SwFrm *pTmp = pStPage; - pStPage = (SwPageFrm*)pEndPage; - pEndPage = pTmp; - nPageNo = nLastPageNo; - } - else - nPageNo = nFirstPageNo; - - // ein Array fuer die Seiten anlegen, die auf eine Drucker-Seite - // gedruckt werden sollen. - BYTE nRow = BYTE(nRowCol >> 8), nCol = BYTE(nRowCol & 0xff); - USHORT nPages = nRow * nCol; - SwPageFrm** aPageArr = new SwPageFrm* [ nPages ]; - memset( aPageArr, 0, sizeof( SwPageFrm* ) * nPages ); - USHORT nCntPage = 0; - - SwTwips nCalcW = 0, nCalcH = 0, nMaxRowSz = 0, nMaxColSz = 0; - - MapMode aOld( pPrt->GetMapMode() ); - MapMode aMapMode( MAP_TWIP ); - Size aPrtSize( pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), aMapMode )); - if( pPrtData ) - { - aPrtSize.Width() -= pPrtData->GetLeftSpace() + - pPrtData->GetRightSpace() + - ( pPrtData->GetHorzSpace() * (nCol - 1)); - aPrtSize.Height() -= pPrtData->GetTopSpace() + - pPrtData->GetBottomSpace() + - ( pPrtData->GetVertSpace() * (nRow - 1)); - } - - aMulti.Select( Range( nLastPageNo+1, USHRT_MAX ), FALSE ); - USHORT nSelCount = USHORT((aMulti.GetSelectCount()+nPages-1) / nPages); - nSelCount = nSelCount * nCopyCnt; - USHORT nPrintCount = 1; - - const XubString aTmp( SW_RES( STR_STATSTR_PRINT ) ); - rProgress.SetText( aTmp ); - //HACK, damit die Anzeige nicht durcheinander kommt: - rProgress.SetState( 1, nSelCount ); - rProgress.SetText( aTmp ); - bStartJob = TRUE; - - while( pStPage ) - { - // Mag der Anwender noch ? - rProgress.Reschedule(); - - if ( !pPrt->IsJobActive() ) - break; - - // --> FME 2005-12-12 #b6354161# Feature - Print empty pages - // --> OD 2007-10-22 #i79738# - correct condition: - // always consider, if page is selected for print. - if( aMulti.IsSelected( nPageNo ) && - ( bPrintEmptyPages || !pStPage->IsEmptyPage() ) ) - // <-- - { - if( rOptions.bPrintReverse ) - aPageArr[ nPages - ++nCntPage ] = (SwPageFrm*)pStPage; - else - aPageArr[ nCntPage++ ] = (SwPageFrm*)pStPage; - - // OD 05.05.2003 #i14016# - consider empty pages on calculation - // of page size, used for calculation of scaling. - Size aPageSize; - if ( pStPage->IsEmptyPage() ) - { - if ( pStPage->GetPhyPageNum() % 2 == 0 ) - aPageSize = pStPage->GetPrev()->Frm().SSize(); - else - aPageSize = pStPage->GetNext()->Frm().SSize(); - } - else - { - aPageSize = pStPage->Frm().SSize(); - } - nCalcW += aPageSize.Width(); - if( nCalcH < aPageSize.Height() ) - nCalcH = aPageSize.Height(); - - if( 0 == (nCntPage % nCol ) || // neue Zeile - nCntPage == nPages || pStPage == pEndPage ) - { - // sollte die Seite nicht gefuellt sein, so erweiter - // anhand der letzen Seite. Dadurch hat auch die - // letze Seite die richtigen Spalten/Reihen. - // BUG: 17695 - if( pStPage == pEndPage && nCntPage != nPages ) - { - // dann Werte mit der letzen Seite auffuellen - if( nCntPage < nCol ) - nCalcW += aPageSize.Width() * (nCol - nCntPage); - - BYTE nRows = (BYTE) ( nCntPage / nCol + 1 ); - if( nRows < nRow ) - nCalcH += ( nRow - nRows ) * nCalcH; - } - - if( nMaxColSz < nCalcW ) - nMaxColSz = nCalcW; - nCalcW = 0; - nMaxRowSz += nCalcH; - } - - if( nCntPage == nPages || pStPage == pEndPage ) - { - // den MapMode einstellen - aMapMode.SetOrigin( Point() ); - { - Fraction aScX( aPrtSize.Width(), nMaxColSz ); - Fraction aScY( aPrtSize.Height(), nMaxRowSz ); - - { - if( aScX < aScY ) - aScY = aScX; - - // fuer Drawing, damit diese ihre Objecte vernuenftig Painten - // koennen, auf "glatte" Prozentwerte setzen - aScY *= Fraction( 1000, 1 ); - long nTmp = (long)aScY; - if( 1 < nTmp ) - --nTmp; - else - nTmp = 1; - aScY = Fraction( nTmp, 1000 ); - aScX = aScY; - } - - aMapMode.SetScaleY( aScY ); - aMapMode.SetScaleX( aScX ); - } - - Point aPrtOff( pPrt->PixelToLogic( - pPrt->GetPageOffsetPixel(), aMapMode ) ); - long nPageHeight = (nMaxRowSz / nRow); - - // dann kann das drucken losgehen - rProgress.SetState( nPrintCount++, nSelCount ); - -#ifdef TL_NOT_NOW /*TLPDF*/ - pPrt->StartPage(); -#endif - Point aCalcPt; - SwPageFrm** ppTmpPg = aPageArr; - - // ist das Array nicht vollsteandig gefuellt ? - if( rOptions.bPrintReverse && nCntPage != nPages ) - { - // beim Rueckwaertsdruck alle Seiten nach vorne - // verschieben! - memmove( ppTmpPg, ppTmpPg + (nPages - nCntPage), - nCntPage * sizeof( SwPageFrm*) ); - aPageArr[ nCntPage ] = 0; // Endekennung - } - - long nHOffs = 0, nVOffs = 0, nXStt = 0; - if( pPrtData ) - { - const Fraction& rScaleX = aMapMode.GetScaleX(); - const Fraction& rScaleY = aMapMode.GetScaleY(); - Fraction aF( pPrtData->GetTopSpace(), 1 ); - aCalcPt.Y() = aF /= rScaleY; - aF = Fraction( pPrtData->GetLeftSpace(), 1 ); - nXStt = aF /= rScaleX; - aF = Fraction( pPrtData->GetVertSpace(), 1 ); - nVOffs = aF /= rScaleY; - aF = Fraction( pPrtData->GetHorzSpace(), 1 ); - nHOffs = aF /= rScaleX; - } - - for( BYTE nR = 0; *ppTmpPg && nR < nRow; ++nR ) - { - aCalcPt.X() = nXStt; - for( BYTE nC = 0; *ppTmpPg && nC < nCol; ++nC ) - { - aShell.Imp()->SetFirstVisPageInvalid(); - aShell.aVisArea = (*ppTmpPg)->Frm(); - - Point aPos( aCalcPt ); - aPos -= aShell.aVisArea.Pos(); - aPos -= aPrtOff; - aMapMode.SetOrigin( aPos ); - pPrt->SetMapMode( aMapMode ); - (*ppTmpPg)->GetUpper()->Paint( (*ppTmpPg)->Frm() ); - // OD 05.05.2003 #i14016# - consider empty pages - // on calculation of the paint offset for the next page. - aCalcPt.X() += nHOffs; - if ( (*ppTmpPg)->IsEmptyPage() ) - { - if ( (*ppTmpPg)->GetPhyPageNum() % 2 == 0 ) - aCalcPt.X() += (*ppTmpPg)->GetPrev()->Frm().SSize().Width(); - else - aCalcPt.X() += (*ppTmpPg)->GetNext()->Frm().SSize().Width(); - } - else - { - aCalcPt.X() += (*ppTmpPg)->Frm().Width(); - } - ++ppTmpPg; - } - aCalcPt.Y() += nVOffs + nPageHeight; - } -#ifdef TL_NOT_NOW /*TLPDF*/ - pPrt->EndPage(); -#endif - SwPaintQueue::Repaint(); - - memset( aPageArr, 0, sizeof( SwPageFrm* ) * nPages ); - nCntPage = 0; - nMaxRowSz = nMaxColSz = nCalcH = nCalcW = 0; - } - } - - if( pStPage == pEndPage ) - pStPage = 0; - else if( rOptions.bPrintReverse ) - { - --nPageNo; - pStPage = (SwPageFrm*)pStPage->GetPrev(); - } - else - { - ++nPageNo; - pStPage = (SwPageFrm*)pStPage->GetNext(); - } - } - pPrt->SetMapMode( aOld ); - - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( (USHORT)aPages.Max() ); - } - delete[] aPageArr; - - if( bStartJob ) - rOptions.bJobStartet = TRUE; - } - pFntCache->Flush(); -} - // print brochure // OD 05.05.2003 #i14016# - consider empty pages on calculation of the scaling @@ -491,7 +131,7 @@ void ViewShell::PrintProspect( aShell.PrepareForPrint( rPrintData ); -#ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! +#if 0 // applying view options and formatting the dcoument should now only be done in getRendererCount! // gibt es versteckte Absatzfelder, unnoetig wenn die Absaetze bereits // ausgeblendet sind. int bHiddenFlds = FALSE; @@ -509,10 +149,10 @@ void ViewShell::PrintProspect( // Seiten fuers Drucken formatieren aShell.CalcPagesForPrint( nPageMax, 0 ); -#endif // TL_NOT_NOW // TLPDF +#endif MapMode aMapMode( MAP_TWIP ); - Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ + Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); SwTwips nMaxRowSz, nMaxColSz; @@ -605,7 +245,7 @@ void ViewShell::PrintProspect( aMapMode.SetScaleX( aScY ); } - Size aTmpPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); /* TLPDF */ + Size aTmpPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); // calculate start point for equal border on all sides Point aSttPt( (aTmpPrtSize.Width() - nMaxColSz) / 2, @@ -619,7 +259,7 @@ void ViewShell::PrintProspect( Point aPos( aSttPt ); aPos -= aShell.aVisArea.Pos(); -// TLPDF aPos -= aPrtOff; +// aPos -= aPrtOff; aMapMode.SetOrigin( aPos ); pPrinter->SetMapMode( aMapMode ); pStPage->GetUpper()->Paint( pStPage->Frm() ); @@ -631,14 +271,14 @@ void ViewShell::PrintProspect( SwPaintQueue::Repaint(); -#ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! +#if 0 // applying view options and formatting the dcoument should now only be done in getRendererCount! if( bHiddenFlds ) { SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); pFldType->Modify( &aHnt, 0); CalcPagesForPrint( nPageMax ); } -#endif // TL_NOT_NOW // TLPDF +#endif pFntCache->Flush(); // restore settings of OutputDevice (should be done always now since the diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index f5a132284021..99c16d68f2bd 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -108,8 +108,6 @@ void ViewShell::Init( const SwViewOption *pNewOpt ) // --> FME 2007-11-06 #i82967# OutputDevice* pPDFOut = 0; -// TLPDF if ( pOut && pOut->GetPDFWriter() ) -// TLPDF pPDFOut = pOut; if ( pOut && pOut->GetPDFWriter() ) pPDFOut = pOut; // <-- @@ -118,11 +116,6 @@ void ViewShell::Init( const SwViewOption *pNewOpt ) // Only setup the printer if we need one: const IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); const bool bBrowseMode = pIDSA->get(IDocumentSettingAccess::BROWSE_MODE); -// TLPDF const bool bCreatePrinter = !bBrowseMode && -// TLPDF !pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE); -// TLPDF SfxPrinter* pPrinter = getIDocumentDeviceAccess()->getPrinter( bCreatePrinter ); -// TLPDF if( pPrinter ) -// TLPDF InitPrt( pPrinter, pPDFOut ); if( pPDFOut ) InitPrt( pPDFOut ); // <-- diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 8cb7f7874a79..05af84c67f06 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -122,19 +122,6 @@ public: SwQueuedPaint *SwPaintQueue::pQueue = 0; -//Klasse zum Speichern einiger Druckereinstellungen -class SwPrtOptSave -{ - Printer *pPrt; - Size aSize; - Paper ePaper; - Orientation eOrientation; - USHORT nPaperBin; -public: - SwPrtOptSave( Printer *pPrinter ); - ~SwPrtOptSave(); -}; - // saves some settings from the draw view class SwDrawViewSave { @@ -324,7 +311,7 @@ void SwRenderData::MakeSwPrtOptions( // get default print options const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); - rOptions.MakeOptions( NULL, NULL, NULL, bWeb, NULL, NULL ); + rOptions.MakeOptions( bWeb ); // get print options to use from provided properties rOptions.bPrintGraphic = pOpt->IsPrintGraphics(); @@ -335,13 +322,13 @@ void SwRenderData::MakeSwPrtOptions( rOptions.bPrintRightPages = pOpt->IsPrintRightPages(); rOptions.bPrintPageBackground = pOpt->getBoolValue( "PrintPageBackground", rOptions.bPrintPageBackground ); rOptions.bPrintEmptyPages = !bIsSkipEmptyPages; - // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + // bUpdateFieldsInPrinting <-- not set here; mail merge only rOptions.bPaperFromSetup = pOpt->getBoolValue( "PrintPaperFromSetup", rOptions.bPaperFromSetup ); rOptions.bPrintReverse = pOpt->getBoolValue( "PrintReversed", rOptions.bPrintReverse ); rOptions.bPrintProspect = pOpt->getBoolValue( "PrintProspect", rOptions.bPrintProspect ); rOptions.bPrintProspectRTL = pOpt->getIntValue( "PrintProspectRTL", rOptions.bPrintProspectRTL ) ? true : false; - // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? + // bPrintSingleJobs <-- not set here; mail merge and or configuration + // bModified <-- not set here; mail merge only rOptions.bPrintBlackFont = pOpt->getBoolValue( "PrintBlackFonts", rOptions.bPrintBlackFont ); rOptions.bPrintHiddenText = pOpt->getBoolValue( "PrintHiddenText", rOptions.bPrintHiddenText ); rOptions.bPrintTextPlaceholder = pOpt->getBoolValue( "PrintTextPlaceholder", rOptions.bPrintTextPlaceholder ); @@ -352,12 +339,9 @@ void SwRenderData::MakeSwPrtOptions( rOptions.SetPrintUIOptions( pOpt ); rOptions.SetRenderData( pData ); - // rOptions.aMulti is not used anymore in the XRenderable API but it is still - // used in ViewShell::PrintPreViewPage. Thus we set it to a dummy value here. - MultiSelection aPages( Range( 1, 1 ) ); -// aPages.SetTotalRange( Range( 0, RANGE_MAX ) ); -// aPages.Select( aRange ); - rOptions.aMulti = aPages; + // rOptions.aMulti is not used anymore in the XRenderable API + // Thus we set it to a dummy value here. + rOptions.aMulti = MultiSelection( Range( 1, 1 ) ); //! Note: Since for PDF export of (multi-)selection a temporary //! document is created that contains only the selects parts, @@ -681,13 +665,8 @@ void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL /*bPDFExport*/ ) // move the start point of the output operation to a position // such that in the output device all pages will be painted // at the same position -// TLPDF if (!bPDFExport) -// TLPDF aPt += pSh->aPrtOffst; aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y(); -// TLPDF OutputDevice *pOut = bPDFExport ? -// TLPDF pSh->GetOut() : -// TLPDF pSh->getIDocumentDeviceAccess()->getPrinter( false ); OutputDevice *pOut = pSh->GetOut(); MapMode aMapMode( pOut->GetMapMode() ); @@ -695,38 +674,31 @@ void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL /*bPDFExport*/ ) pOut->SetMapMode( aMapMode ); } -/****************************************************************************** - * Methode : void ViewShell::InitPrt( Printer *pNew, OutputDevice *pPDFOut ) - * Beschreibung: - * Erstellt : OK 07.11.94 10:22 - * Aenderung : - ******************************************************************************/ +/******************************************************************************/ -void ViewShell::InitPrt( /*Printer *pPrt,*/ OutputDevice *pOutDev ) /* TLPDF */ +void ViewShell::InitPrt( OutputDevice *pOutDev ) { //Fuer den Printer merken wir uns einen negativen Offset, der //genau dem Offset de OutputSize entspricht. Das ist notwendig, //weil unser Ursprung der linken ober Ecke der physikalischen //Seite ist, die Ausgaben (SV) aber den Outputoffset als Urstprung //betrachten. - OutputDevice *pTmpDev = pOutDev; // TLPDF pPDFOut ? pPDFOut : (OutputDevice *) pPrt; - if ( pTmpDev ) + if ( pOutDev ) { -// TLPDF aPrtOffst = pPrt ? pPrt->GetPageOffset() : Point(); aPrtOffst = Point(); - aPrtOffst += pTmpDev->GetMapMode().GetOrigin(); - MapMode aMapMode( pTmpDev->GetMapMode() ); + aPrtOffst += pOutDev->GetMapMode().GetOrigin(); + MapMode aMapMode( pOutDev->GetMapMode() ); aMapMode.SetMapUnit( MAP_TWIP ); - pTmpDev->SetMapMode( aMapMode ); - pTmpDev->SetLineColor(); - pTmpDev->SetFillColor(); + pOutDev->SetMapMode( aMapMode ); + pOutDev->SetLineColor(); + pOutDev->SetFillColor(); } else aPrtOffst.X() = aPrtOffst.Y() = 0; if ( !pWin ) - pOut = pTmpDev; //Oder was sonst? + pOut = pOutDev; //Oder was sonst? } /****************************************************************************** @@ -894,7 +866,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress ) /******************************************************************************/ -SwDoc * ViewShell::CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef &rDocShellRef) // TLPDF +SwDoc * ViewShell::CreatePrtDoc( SfxObjectShellRef &rDocShellRef) { ASSERT( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); SwFEShell* pFESh = (SwFEShell*)this; @@ -904,11 +876,6 @@ SwDoc * ViewShell::CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef &rDocShell pPrtDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)rDocShellRef ); pPrtDoc->LockExpFlds(); -/* TLPDF - // Der Drucker wird uebernommen - if (pPrt) - pPrtDoc->setPrinter( pPrt, true, true ); -*/ const SfxPoolItem* pCpyItem; const SfxItemPool& rPool = GetAttrPool(); for( USHORT nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh ) @@ -1080,12 +1047,11 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) sal_Bool ViewShell::PrintOrPDFExport( OutputDevice *pOutDev, const SwPrtOptions &rPrintData, - sal_Int32 nRenderer, // the index in the vector of pages to be printed - bool /* TLPDF bIsPDFExport*/ ) + sal_Int32 nRenderer /* the index in the vector of pages to be printed */ ) { -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -//Immer die Druckroutinen in viewpg.cxx (PrintPreViewPage und PrintProspect) mitpflegen!! -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//Immer die Druckroutinen in viewpg.cxx (PrintProspect) mitpflegen!! +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagesToPrint().size() - 1; #if OSL_DEBUG_LEVEL > 1 @@ -1098,9 +1064,6 @@ sal_Bool ViewShell::PrintOrPDFExport( // output device is now provided by a call from outside the Writer) pOutDev->Push(); - // Einstellungen am Drucker merken -// SwPrtOptSave aPrtSave( pOutDev ); /* TLPDF wo dann heutzutage ??? */ - // eine neue Shell fuer den Printer erzeugen ViewShell *pShell; SwDoc *pOutDevDoc; @@ -1123,7 +1086,7 @@ sal_Bool ViewShell::PrintOrPDFExport( // to be created that often here in the 'then' part. if ( bSelection ) { - pOutDevDoc = CreatePrtDoc( /*TLPDF pOutDev,*/ aDocShellRef ); + pOutDevDoc = CreatePrtDoc( aDocShellRef ); // eine ViewShell darauf pShell = new ViewShell( *pOutDevDoc, 0, pOpt, pOutDev ); @@ -1138,8 +1101,8 @@ sal_Bool ViewShell::PrintOrPDFExport( SdrView *pDrawView = pShell->GetDrawView(); if (pDrawView) { - pDrawView->SetBufferedOutputAllowed( false ); // TLPDF - pDrawView->SetBufferedOverlayAllowed( false ); // TLPDF + pDrawView->SetBufferedOutputAllowed( false ); + pDrawView->SetBufferedOverlayAllowed( false ); } { //Zusaetzlicher Scope, damit die CurrShell vor dem zerstoeren der @@ -1156,7 +1119,7 @@ sal_Bool ViewShell::PrintOrPDFExport( pShell->PrepareForPrint( rPrintData ); - const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ + const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ]; #if OSL_DEBUG_LEVEL > 1 DBG_ASSERT( nPage == 0 || rPrintData.GetRenderData().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif @@ -1177,7 +1140,7 @@ sal_Bool ViewShell::PrintOrPDFExport( } DBG_ASSERT( pStPage, "failed to get start page" ); -#ifdef TL_NOT_NOW // TLPDF: applying view options and formatting the dcoument should now only be done in getRendererCount! +#if 0 // applying view options and formatting the dcoument should now only be done in getRendererCount! // benoetigte Seiten fuers Drucken formatieren pShell->CalcPagesForPrint( (USHORT)nPage, 0 ); @@ -1190,11 +1153,11 @@ sal_Bool ViewShell::PrintOrPDFExport( if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) pShell->UpdateFlds(TRUE); // <-- -#endif // TL_NOT_NOW // TLPDF +#endif ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ rPrintData.GetRenderData().m_pPostItShell : pShell; - ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF + ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // wenn wir einen Umschlag drucken wird ein Offset beachtet if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET ) @@ -1210,7 +1173,7 @@ sal_Bool ViewShell::PrintOrPDFExport( pViewSh2 = nPage == 0 ? /* post-it page? */ rPrintData.GetRenderData().m_pPostItShell : pShell; - ::SetSwVisArea( pViewSh2, pStPage->Frm() ); // TLPDF + ::SetSwVisArea( pViewSh2, pStPage->Frm() ); pStPage->GetUpper()->Paint( pStPage->Frm() ); @@ -1316,52 +1279,6 @@ BOOL ViewShell::IsAnyFieldInDoc() const -/****************************************************************************** - * Klasse : SwPrtOptSave - * Erstellt : AMA 12.07.95 - * Aenderung : AMA 12.07.95 - * Holt sich im Ctor folgende Einstellungen des Druckers, die im Dtor dann - * wieder im Drucker gesetzt werden (falls sie sich ueberhaupt geaendert haben) - * - PaperBin - Orientation - PaperSize - - ******************************************************************************/ - - - -SwPrtOptSave::SwPrtOptSave( Printer *pPrinter ) - : pPrt( pPrinter ) -{ - if ( pPrt ) - { - ePaper = pPrt->GetPaper(); - if ( PAPER_USER == ePaper ) - aSize = pPrt->GetPaperSize(); - eOrientation = pPrt->GetOrientation(); - nPaperBin = pPrt->GetPaperBin(); - - } -} - - - -SwPrtOptSave::~SwPrtOptSave() -{ - if ( pPrt ) - { - if ( PAPER_USER == ePaper ) - { - if( pPrt->GetPaperSize() != aSize ) - pPrt->SetPaperSizeUser( aSize ); - } - else if ( pPrt->GetPaper() != ePaper ) - pPrt->SetPaper( ePaper ); - if ( pPrt->GetOrientation() != eOrientation) - pPrt->SetOrientation( eOrientation ); - if ( pPrt->GetPaperBin() != nPaperBin ) - pPrt->SetPaperBin( nPaperBin ); - } -} - - /****************************************************************************** * SwDrawViewSave * diff --git a/sw/source/ui/inc/pview.hxx b/sw/source/ui/inc/pview.hxx index bcb96a26cb3d..9fe9e61e2d6f 100644 --- a/sw/source/ui/inc/pview.hxx +++ b/sw/source/ui/inc/pview.hxx @@ -222,8 +222,6 @@ class SW_DLLPUBLIC SwPagePreView: public SfxViewShell SW_DLLPRIVATE int ChgPage( int eMvMode, int bUpdateScrollbar = TRUE ); - SW_DLLPRIVATE virtual USHORT Print( SfxProgress &rProgress, BOOL bIsAPI, - PrintDialog *pPrintDialog = 0 ); SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE ); SW_DLLPRIVATE virtual USHORT SetPrinter( SfxPrinter *pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 81958e19be19..ac10369d241c 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1779,7 +1779,7 @@ void SwPagePreView::Init(const SwViewOption * pPrefs) // OD 09.01.2003 #i6467# - adjust view shell option to the same as for print SwPrtOptions aPrintOptions( GetViewFrame()->GetObjectShell()->GetTitle(0) ); - aPrintOptions.MakeOptions( 0, 0, 0, false, 0, 0 ); + aPrintOptions.MakeOptions( false ); GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions ); IDocumentSettingAccess* pIDSA = pESh->getIDocumentSettingAccess(); @@ -2408,20 +2408,6 @@ void SwPagePreView::ScrollDocSzChg() // alles zum Thema Drucken -USHORT SwPagePreView::Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pDlg ) -{ - (void) rProgress; (void) bIsAPI; (void) pDlg; - // TLPDF no longer needed in new print UI - // TLPDF TODO: clean-up - - return 0; // OK -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - - SfxPrinter* SwPagePreView::GetPrinter( BOOL bCreate ) { return aViewWin.GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate ); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 1dedc5c67487..594387f062f1 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1989,51 +1989,17 @@ void SwView::AddTransferable(SwTransferable& rTransferable) /* --------------------------------------------------*/ -void SwPrtOptions::MakeOptions( PrintDialog* pDlg, - BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, - SfxPrinter* pPrt, SwPrintData* pData ) +void SwPrtOptions::MakeOptions( BOOL bWeb ) { - SwAddPrinterItem* pAddPrinterAttr; - if( pPrt && SFX_ITEM_SET == pPrt->GetOptions().GetItemState( - FN_PARAM_ADDPRINTER, FALSE, (const SfxPoolItem**)&pAddPrinterAttr )) - { - pData = pAddPrinterAttr; - } - else if(!pData) - { - pData = SW_MOD()->GetPrtOptions(bWeb); - } - *this = *pData; - if( pPrtProspect ) - *pPrtProspect = pData->bPrintProspect; - if( pPrtProspect_RTL ) - *pPrtProspect_RTL = pData->bPrintProspectRTL; - aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); - aMulti.SelectAll( FALSE ); + *this = *SW_MOD()->GetPrtOptions(bWeb); + nCopyCount = 1; bCollate = FALSE; bPrintSelection = FALSE; bJobStartet = FALSE; - if ( pDlg ) - { - nCopyCount = pDlg->GetCopyCount(); - bCollate = pDlg->IsCollateChecked(); - if ( pDlg->GetCheckedRange() == PRINTDIALOG_SELECTION ) - { - aMulti.SelectAll(); - bPrintSelection = TRUE; - } - else if ( PRINTDIALOG_ALL == pDlg->GetCheckedRange() ) - aMulti.SelectAll(); - else - { - aMulti = MultiSelection( pDlg->GetRangeText() ); - aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); - } - } - else - aMulti.SelectAll(); + aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); + aMulti.SelectAll(); aMulti.Select( 0, FALSE ); } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index f9fff177a788..ad63882100ec 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2946,7 +2946,7 @@ void SAL_CALL SwXTextDocument::render( if (bPrintProspect) pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); else // normal printing and PDF export - pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer, bIsPDFExport ); + pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer ); // --> FME 2004-10-08 #i35176# // -- cgit v1.2.3 From 99db98914d9a700541cd138ab5a705119d2a9480 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 4 Sep 2009 14:50:39 +0000 Subject: #i101242# start grammar checking only for docs with visible views --- sw/source/core/doc/docnew.cxx | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 67c64e27b9d0..d7a12d52aacd 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -168,15 +169,30 @@ SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr) void StartGrammarChecking( SwDoc &rDoc ) { - uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() ); - if ( xGCIterator.is() ) + // check for a visible view + bool bVisible = false; + const SwDocShell *pDocShell = rDoc.GetDocShell(); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False ); + while (pFrame && !bVisible) { - uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY ); - uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY ); + if (pFrame->IsVisible()) + bVisible = true; + pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); + } - // start automatic background checking if not active already - if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) ) - xGCIterator->startProofreading( xDoc, xFPIP ); + // only documents with visible views need to be checked + if (bVisible) + { + uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() ); + if ( xGCIterator.is() ) + { + uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY ); + uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY ); + + // start automatic background checking if not active already + if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) ) + xGCIterator->startProofreading( xDoc, xFPIP ); + } } } -- cgit v1.2.3 From 3c4cf485fa3f4efb4f9c3548c4b5acb441bd0f50 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 7 Sep 2009 08:12:29 +0000 Subject: #i101242# start grammar checking only for docs with visible views --- sw/source/core/doc/docnew.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index d7a12d52aacd..ad0a124e6b74 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -181,6 +181,7 @@ void StartGrammarChecking( SwDoc &rDoc ) } // only documents with visible views need to be checked + //(E.g. don't check temporary documents created for printing, see printing of notes and selections) if (bVisible) { uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() ); -- cgit v1.2.3 From 01c741ee90f41de09410413d81f779d88bb050a8 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 7 Sep 2009 09:14:38 +0000 Subject: #i101242# start grammar checking only for docs with visible views --- sw/source/core/doc/docnew.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ad0a124e6b74..aab5ca48ed7d 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -180,8 +180,10 @@ void StartGrammarChecking( SwDoc &rDoc ) pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); } - // only documents with visible views need to be checked - //(E.g. don't check temporary documents created for printing, see printing of notes and selections) + //!! only documents with visible views need to be checked + //!! (E.g. don't check temporary documents created for printing, see printing of notes and selections. + //!! Those get created on the fly and get hard deleted a bit later as well, and no one should have + //!! a uno reference to them) if (bVisible) { uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() ); -- cgit v1.2.3 From 37de7b4f82272ea2fe43d3d39cc7a59995ba0f87 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 7 Sep 2009 10:38:39 +0000 Subject: remove unused variable --- sw/source/core/doc/doc.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 4aabbc29b693..2d0f9c6115ed 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1041,7 +1041,6 @@ USHORT _PostItFld::GetPageNo( (pFrm->HasFollow() && pFrm->GetFollow()->GetOfst() <= nPos) ) continue; USHORT nPgNo = pFrm->GetPhyPageNum(); - BOOL bRight = pFrm->OnRightPage(); if( rRangeEnum.hasValue( nPgNo, &rPossiblePages )) { rLineNo = (USHORT)(pFrm->GetLineCount( nPos ) + -- cgit v1.2.3 From fbfff407749fbec15066d74fb34aae9c274431af Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 7 Sep 2009 11:19:30 +0000 Subject: #104693# fixed page size and map mode unit conversion problem for brochure printing --- sw/source/ui/uno/unotxdoc.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index ad63882100ec..201d7900053f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2755,7 +2755,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( uno::Sequence< beans::PropertyValue > aRenderer; if (m_pRenderData) { - Size aPgSize; + awt::Size aPageSize; + Size aTmpSize; if (bIsSwSrcView || m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False )) { // for printing of HTML source code and prospect printing we should use @@ -2771,15 +2772,20 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // for the correct PageSisze right now... Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); if (pPrinter) - aPgSize = pPrinter->GetPaperSize(); + { + aTmpSize = pPrinter->GetPaperSize(); + aTmpSize = pPrinter->LogicToLogic( aTmpSize, + pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); + aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); + } } else { bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - aPgSize = pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ); + aTmpSize = pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ); + aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ), + TWIP_TO_MM100( aTmpSize.Height() )); } - awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), - TWIP_TO_MM100( aPgSize.Height() )); aRenderer.realloc(2); aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); -- cgit v1.2.3 From 22377e630acfe8339dd760db2b223d6700705888 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 7 Sep 2009 12:11:46 +0000 Subject: #104693# assertion fixed --- sw/source/ui/uno/unotxdoc.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 201d7900053f..8e2d8336738d 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2542,18 +2542,22 @@ SwDoc * SwXTextDocument::GetRenderDoc( pDoc = pDocShell->GetDoc(); else { - // important check since GuessViewShell below should only get called for PDF export. - // Otherwise the View should be obtained from the "View" property passed on in the - // calls to the XRenderable functions. - DBG_ASSERT( bIsPDFExport, "code should have been called for PDF export only..." ); - (void)bIsPDFExport; // avoid warning in non dbg case + DBG_ASSERT( !xModel.is(), "unexpected model found" ); - // used for PDF export of (multi-)selection if (rSelection.hasValue()) // is anything selected ? { + // this part should only be called when a temporary document needs to be created, + // for example for PDF export or printing of (multi-)selection only. + bool bIsSwSrcView = false; if (!rpView) + { + (void) bIsPDFExport; + // aside from maybe PDF export the view should always have been provided! + DBG_ASSERT( bIsPDFExport, "view is missing, guessing one..." ); + rpView = GuessViewShell( bIsSwSrcView ); + } DBG_ASSERT( rpView, "ViewShell missing" ); // the view shell should be SwView for documents PDF export. // for the page preview no selection should be possible @@ -2568,7 +2572,8 @@ SwDoc * SwXTextDocument::GetRenderDoc( rpView = pDoc->GetDocShell()->GetView(); } } - else { + else + { DBG_ERROR( "unexpected ViewShell" ); } } -- cgit v1.2.3 From 3ed5b6c9c6530c75a5ae9f6d60f6149451701001 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 7 Sep 2009 14:50:54 +0000 Subject: #104693# brochure printing with different page formats --- sw/source/core/view/vprint.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 30 ++++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 05af84c67f06..a59bfc714fa5 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -495,7 +495,7 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : aHelpText.realloc( 2 ); aHelpText[0] = aLocalizedStrings.GetString( 25 ); aHelpText[1] = aLocalizedStrings.GetString( 25 ); - vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 1, sal_False ); + vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 8e2d8336738d..33c1b97483f7 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2732,7 +2732,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); + const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); + const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); @@ -2762,7 +2763,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( { awt::Size aPageSize; Size aTmpSize; - if (bIsSwSrcView || m_pPrintUIOptions->getBoolValue( "PrintProspect", sal_False )) + if (bIsSwSrcView || bPrintProspect) { // for printing of HTML source code and prospect printing we should use // the printers paper size since @@ -2778,16 +2779,29 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); if (pPrinter) { - aTmpSize = pPrinter->GetPaperSize(); - aTmpSize = pPrinter->LogicToLogic( aTmpSize, - pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); - aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); + if (bPrintProspect) + { + aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages ); + // we just state what output size we would need + // the rest is now up to vcl + long nWidth = 2 * aTmpSize.Width(); + long nHeight = aTmpSize.Height(); + aPageSize = awt::Size ( TWIP_TO_MM100( nWidth ), + TWIP_TO_MM100( nHeight )); + } + else + { + // printing HTML source view + aTmpSize = pPrinter->GetPaperSize(); + aTmpSize = pPrinter->LogicToLogic( aTmpSize, + pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); + aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); + } } } else { - bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - aTmpSize = pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ); + aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages ); aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ), TWIP_TO_MM100( aTmpSize.Height() )); } -- cgit v1.2.3 From 222ce842dbdbdad1d50cba06fc26968b9363bf0b Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 7 Sep 2009 14:52:54 +0000 Subject: #104693# brochure printing with different page formats --- sw/source/ui/uno/unotxdoc.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 33c1b97483f7..b41a496bc6c4 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2783,11 +2783,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( { aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages ); // we just state what output size we would need - // the rest is now up to vcl - long nWidth = 2 * aTmpSize.Width(); - long nHeight = aTmpSize.Height(); - aPageSize = awt::Size ( TWIP_TO_MM100( nWidth ), - TWIP_TO_MM100( nHeight )); + // the rest is nowadays up to vcl + aPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ), + TWIP_TO_MM100( aTmpSize.Height() )); } else { -- cgit v1.2.3 From fdb61865536ef1dfaf08c8600958432846c50f57 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 8 Sep 2009 17:17:32 +0000 Subject: merge strings from string review --- sw/source/ui/config/optdlg.src | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 736cbd881212..48a88ceb58c2 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -956,15 +956,15 @@ StringArray STR_PRINTOPTUI < "Print text in blac~k"; >; < "Specifies whether to always print text in black."; >; < "Pages"; >; - < "~Add blank pages for page breaks"; >; + < "Print ~automatically inserted blank pages"; >; < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; < "~Use only paper tray from printer preferences"; >; < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; < "Print"; >; - < "Document only"; >; + < "None (document only)"; >; < "Notes only"; >; - < " at end of document"; >; - < " at end of page"; >; + < "Place at end of document"; >; + < "Place at end of page"; >; < "Specify where to print notes (if any)."; >; < "~Notes"; >; < "Page sides";>; -- cgit v1.2.3 From dac4275c1bb031c2f52b5069493bea2100a12701 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 15 Sep 2009 16:06:13 +0200 Subject: #i97509# seperated base and buffered classes for 2D and 3D, adapted aqll usages --- sw/source/core/draw/dflyobj.cxx | 12 ++++++------ sw/source/ui/docvw/postit.cxx | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 15ca46ca2456..e1033aa3d818 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -196,7 +196,7 @@ namespace drawinglayer { namespace primitive2d { - class SwVirtFlyDrawObjPrimitive : public BasePrimitive2D + class SwVirtFlyDrawObjPrimitive : public BufDecPrimitive2D { private: const SwVirtFlyDrawObj& mrSwVirtFlyDrawObj; @@ -204,13 +204,13 @@ namespace drawinglayer protected: // method which is to be used to implement the local decomposition of a 2D primitive - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: SwVirtFlyDrawObjPrimitive( const SwVirtFlyDrawObj& rSwVirtFlyDrawObj, const basegfx::B2DRange &rOuterRange) - : BasePrimitive2D(), + : BufDecPrimitive2D(), mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj), maOuterRange(rOuterRange) { @@ -239,7 +239,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SwVirtFlyDrawObjPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence SwVirtFlyDrawObjPrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; @@ -269,7 +269,7 @@ namespace drawinglayer bool SwVirtFlyDrawObjPrimitive::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufDecPrimitive2D::operator==(rPrimitive)) { const SwVirtFlyDrawObjPrimitive& rCompare = (SwVirtFlyDrawObjPrimitive&)rPrimitive; @@ -295,7 +295,7 @@ namespace drawinglayer getSwVirtFlyDrawObj().wrap_DoPaintObject(); // call parent - return BasePrimitive2D::get2DDecomposition(rViewInformation); + return BufDecPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index a9809e07e496..c2754f18acd0 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -1990,7 +1990,7 @@ private: ShadowState maShadowState; protected: - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition( + virtual drawinglayer::primitive2d::Primitive2DSequence createLocal2DDecomposition( const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: @@ -2009,12 +2009,12 @@ public: const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } ShadowState getShadowState() const { return maShadowState; } - virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const; + virtual bool operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const; DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLocalDecomposition( +drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLocal2DDecomposition( const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const { // get logic sizes in object coordinate system @@ -2095,7 +2095,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLo return xRetval; } -bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const +bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const { if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { @@ -2177,7 +2177,7 @@ private: bool mbLineSolid : 1; protected: - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition( + virtual drawinglayer::primitive2d::Primitive2DSequence createLocal2DDecomposition( const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: @@ -2211,12 +2211,12 @@ public: bool getShadow() const { return mbShadow; } bool getLineSolid() const { return mbLineSolid; } - virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const; + virtual bool operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const; DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLocalDecomposition( +drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLocal2DDecomposition( const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const { drawinglayer::primitive2d::Primitive2DSequence aRetval; @@ -2331,7 +2331,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLoc return aRetval; } -bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const +bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const { if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { -- cgit v1.2.3 From 795cd663c621fdecd0f313f76afe06ce3342bb12 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 15 Sep 2009 19:08:28 +0200 Subject: #i97509# changed base classes for primitives which need no buffering --- sw/source/core/draw/dflyobj.cxx | 8 ++++---- sw/source/ui/docvw/postit.cxx | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index e1033aa3d818..7d25656de299 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -196,7 +196,7 @@ namespace drawinglayer { namespace primitive2d { - class SwVirtFlyDrawObjPrimitive : public BufDecPrimitive2D + class SwVirtFlyDrawObjPrimitive : public BufferedDecompositionPrimitive2D { private: const SwVirtFlyDrawObj& mrSwVirtFlyDrawObj; @@ -210,7 +210,7 @@ namespace drawinglayer SwVirtFlyDrawObjPrimitive( const SwVirtFlyDrawObj& rSwVirtFlyDrawObj, const basegfx::B2DRange &rOuterRange) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj), maOuterRange(rOuterRange) { @@ -269,7 +269,7 @@ namespace drawinglayer bool SwVirtFlyDrawObjPrimitive::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SwVirtFlyDrawObjPrimitive& rCompare = (SwVirtFlyDrawObjPrimitive&)rPrimitive; @@ -295,7 +295,7 @@ namespace drawinglayer getSwVirtFlyDrawObj().wrap_DoPaintObject(); // call parent - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index c2754f18acd0..7d421b49b867 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -2009,7 +2009,7 @@ public: const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } ShadowState getShadowState() const { return maShadowState; } - virtual bool operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const; + virtual bool operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const; DeclPrimitrive2DIDBlock() }; @@ -2095,7 +2095,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLo return xRetval; } -bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const +bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const { if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { @@ -2211,7 +2211,7 @@ public: bool getShadow() const { return mbShadow; } bool getLineSolid() const { return mbLineSolid; } - virtual bool operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const; + virtual bool operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const; DeclPrimitrive2DIDBlock() }; @@ -2331,7 +2331,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLoc return aRetval; } -bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BufDecPrimitive2D& rPrimitive ) const +bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const { if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { -- cgit v1.2.3 From 290947b519dc9a3ac89406075d7988f4e772c10d Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 17 Sep 2009 17:20:13 +0200 Subject: #i97509# added base class for 3d primitive, re-structured group primitives, added documentation --- sw/source/core/draw/dflyobj.cxx | 4 ++-- sw/source/ui/docvw/postit.cxx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 7d25656de299..cda428f124eb 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -204,7 +204,7 @@ namespace drawinglayer protected: // method which is to be used to implement the local decomposition of a 2D primitive - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: SwVirtFlyDrawObjPrimitive( @@ -239,7 +239,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SwVirtFlyDrawObjPrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence SwVirtFlyDrawObjPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index 7d421b49b867..c306e73ba695 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -1990,7 +1990,7 @@ private: ShadowState maShadowState; protected: - virtual drawinglayer::primitive2d::Primitive2DSequence createLocal2DDecomposition( + virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition( const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: @@ -2009,12 +2009,12 @@ public: const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } ShadowState getShadowState() const { return maShadowState; } - virtual bool operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const; + virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const; DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLocal2DDecomposition( +drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::create2DDecomposition( const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const { // get logic sizes in object coordinate system @@ -2095,7 +2095,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::createLo return xRetval; } -bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const +bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const { if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { @@ -2177,7 +2177,7 @@ private: bool mbLineSolid : 1; protected: - virtual drawinglayer::primitive2d::Primitive2DSequence createLocal2DDecomposition( + virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition( const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: @@ -2211,12 +2211,12 @@ public: bool getShadow() const { return mbShadow; } bool getLineSolid() const { return mbLineSolid; } - virtual bool operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const; + virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const; DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLocal2DDecomposition( +drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::create2DDecomposition( const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const { drawinglayer::primitive2d::Primitive2DSequence aRetval; @@ -2331,7 +2331,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLoc return aRetval; } -bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BufferedDecompositionPrimitive2D& rPrimitive ) const +bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const { if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) { -- cgit v1.2.3 From b0a85159e5f99baee901adad447a157f65e507b4 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 22 Sep 2009 18:14:05 +0200 Subject: #i97509# continued matrix tooling and adapting the usages now to all the ooo code --- sw/source/core/draw/dcontact.cxx | 29 +++++------------------------ sw/source/core/unocore/unodraw.cxx | 15 ++++----------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index aa20281038da..5d9b90a2f9e0 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -44,7 +44,6 @@ #include #include #include -// AW, OD 2004-04-30 #i28501# #include #include #include @@ -69,31 +68,17 @@ #include #include #include - -// OD 2004-02-11 #110582#-2 #include - -// OD 18.06.2003 #108784# -#include -// OD 2004-05-24 #i28701# #include #include - -// AW: For VCOfDrawVirtObj and stuff -#ifndef _SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX +#include #include -#endif - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX #include -#endif - -#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX #include -#endif - #include +#include + using namespace ::com::sun::star; @@ -2605,9 +2590,7 @@ void SwDrawVirtObj::RecalcBoundRect() basegfx::B2DPolyPolygon SwDrawVirtObj::TakeXorPoly() const { basegfx::B2DPolyPolygon aRetval(rRefObj.TakeXorPoly()); - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate(GetOffset().X(), GetOffset().Y()); - aRetval.transform(aMatrix); + aRetval.transform(basegfx::tools::createTranslateB2DHomMatrix(GetOffset().X(), GetOffset().Y())); return aRetval; } @@ -2615,9 +2598,7 @@ basegfx::B2DPolyPolygon SwDrawVirtObj::TakeXorPoly() const basegfx::B2DPolyPolygon SwDrawVirtObj::TakeContour() const { basegfx::B2DPolyPolygon aRetval(rRefObj.TakeContour()); - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate(GetOffset().X(), GetOffset().Y()); - aRetval.transform(aMatrix); + aRetval.transform(basegfx::tools::createTranslateB2DHomMatrix(GetOffset().X(), GetOffset().Y())); return aRetval; } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 1989c74df6ed..c75e4b691b51 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -75,19 +75,12 @@ #include #include #include -// OD 2004-05-05 #i28701# +#include #include -// --> OD 2004-11-10 #i35007# #include -// <-- -// --> OD 2005-03-10 #i44334#, #i44681# -// --> OD 2007-01-03 #i73079# - use correct matrix type #include -// <-- -// --> OD 2009-01-16 #i59051 +#include #include -// <-- - #include #include #include @@ -2844,8 +2837,8 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) // apply translation difference to PolyPolygonBezier. if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 ) { - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( aTranslateDiff.X, aTranslateDiff.Y ); + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + aTranslateDiff.X, aTranslateDiff.Y)); const sal_Int32 nOuterSequenceCount(aConvertedPath.Coordinates.getLength()); drawing::PointSequence* pInnerSequence = aConvertedPath.Coordinates.getArray(); -- cgit v1.2.3 From c9bcf9f449b11e500cf5261dcc75f768463af69f Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 7 Oct 2009 15:58:05 +0000 Subject: #i105596# Notes are nowadays called Comments --- sw/source/ui/config/optdlg.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 48a88ceb58c2..81acd9c97d76 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -962,11 +962,11 @@ StringArray STR_PRINTOPTUI < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; < "Print"; >; < "None (document only)"; >; - < "Notes only"; >; + < "Comments only"; >; < "Place at end of document"; >; < "Place at end of page"; >; - < "Specify where to print notes (if any)."; >; - < "~Notes"; >; + < "Specify where to print comments (if any)."; >; + < "~Comments"; >; < "Page sides";>; < "All pages"; >; < "Back sides / left pages"; >; -- cgit v1.2.3 From 280c91547547808fae0def1eeb47079c65570a0b Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 7 Oct 2009 16:44:04 +0000 Subject: #i105265# pass correct number of options --- sw/source/core/view/vprint.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index a59bfc714fa5..764e9d72a8bd 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -539,7 +539,7 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : ); // create a bool option for brochure RTL dependent on brochure - uno::Sequence< rtl::OUString > aBRTLChoices( 3 ); + uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); -- cgit v1.2.3 From c991f55f85fc9b448d9741726bffbdebc4344605 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 7 Oct 2009 17:59:15 +0000 Subject: #i105695# do not miss cleanup of m_pPrintUIOptions and m_pRenderData --- sw/source/ui/uno/unotxdoc.cxx | 261 +++++++++++++++++++++--------------------- 1 file changed, 132 insertions(+), 129 deletions(-) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index b41a496bc6c4..ae216c9aff5f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2615,8 +2615,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( sal_Int32 nRet = 0; if (bIsSwSrcView) { - SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); - OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); + OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); nRet = pSwSrcView->PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ ); } else @@ -2743,20 +2743,20 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // due to #110067# (document page count changes sometimes during // PDF export/printing) we can not check for the upper bound properly. // Thus instead of throwing the exception we silently return. - if (0 > nRenderer) - throw IllegalArgumentException(); - sal_Int32 nMaxRenderer = 0; - if (!bIsSwSrcView && m_pRenderData) - { - DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); - nMaxRenderer = bPrintProspect? - m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : - m_pRenderData->GetPagesToPrint().size() - 1; - } - // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print - // we obmit checking of the upper bound in this case. - if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer) - return uno::Sequence< beans::PropertyValue >(); + if (0 > nRenderer) + throw IllegalArgumentException(); + sal_Int32 nMaxRenderer = 0; + if (!bIsSwSrcView && m_pRenderData) + { + DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); + nMaxRenderer = bPrintProspect? + m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : + m_pRenderData->GetPagesToPrint().size() - 1; + } + // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print + // we obmit checking of the upper bound in this case. + if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer) + return uno::Sequence< beans::PropertyValue >(); uno::Sequence< beans::PropertyValue > aRenderer; if (m_pRenderData) @@ -2776,20 +2776,20 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this // case we won't get an OutputDevice here, but then the caller also has no need // for the correct PageSisze right now... - Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); - if (pPrinter) - { - if (bPrintProspect) - { + Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); + if (pPrinter) + { + if (bPrintProspect) + { aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages ); // we just state what output size we would need // the rest is nowadays up to vcl aPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ), TWIP_TO_MM100( aTmpSize.Height() )); - } - else - { - // printing HTML source view + } + else + { + // printing HTML source view aTmpSize = pPrinter->GetPaperSize(); aTmpSize = pPrinter->LogicToLogic( aTmpSize, pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); @@ -2871,6 +2871,12 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); + // due to #110067# (document page count changes sometimes during + // PDF export/printing) we can not check for the upper bound properly. + // Thus instead of throwing the exception we silently return. + if (0 > nRenderer) + throw IllegalArgumentException(); + const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); bool bIsSwSrcView = false; SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); @@ -2886,127 +2892,124 @@ void SAL_CALL SwXTextDocument::render( } m_pPrintUIOptions->processProperties( rxOptions ); const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); + const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); - if (!pDoc || !pView) - return; - - // due to #110067# (document page count changes sometimes during - // PDF export/printing) we can not check for the upper bound properly. - // Thus instead of throwing the exception we silently return. - if (0 > nRenderer) - throw IllegalArgumentException(); - sal_Int32 nMaxRenderer = 0; - if (!bIsSwSrcView) - { - DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); - nMaxRenderer = bPrintProspect? - m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : - m_pRenderData->GetPagesToPrint().size() - 1; - } - // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print - // we obmit checking of the upper bound in this case. - if (!bIsSwSrcView && nRenderer > nMaxRenderer) - return; - - if (bIsSwSrcView) - { - SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); - OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); - pSwSrcView->PrintSource( pOutDev, nRenderer + 1, false ); - } - else + if (pDoc && pView) { - // the view shell should be SwView for documents PDF export - // or SwPagePreView for PDF export of the page preview - //!! (check for SwView first as in GuessViewShell) !! - DBG_ASSERT( pView, "!! view missing !!" ); - const TypeId aSwViewTypeId = TYPE(SwView); - ViewShell* pVwSh = 0; - if (pView) + sal_Int32 nMaxRenderer = 0; + if (!bIsSwSrcView) { - pVwSh = pView->IsA(aSwViewTypeId) ? - ((SwView*)pView)->GetWrtShellPtr() : - ((SwPagePreView*)pView)->GetViewShell(); + DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); + nMaxRenderer = bPrintProspect? + m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : + m_pRenderData->GetPagesToPrint().size() - 1; } - - // get output device to use - OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); - - if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) + // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print + // we obmit checking of the upper bound in this case. + if (bIsSwSrcView || nRenderer <= nMaxRenderer) { - const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); - const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); - const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); - bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); - - DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) - || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), - "SwView / SwViewOptionAdjust_Impl availability mismatch" ); - - // since printing now also use the API for PDF export this option - // should be set for printing as well ... - pVwSh->SetPDFExportOption( sal_True ); - - // --> FME 2004-06-08 #i12836# enhanced pdf export - // - // First, we have to export hyperlinks, notes, and outline to pdf. - // During this process, additional information required for tagging - // the pdf file are collected, which are evaulated during painting. - // - SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ? - ((SwView*)pView)->GetWrtShellPtr() : - 0; - - if (bIsPDFExport && bFirstPage && pWrtShell) + if (bIsSwSrcView) { - SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); + SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); + OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + pSwSrcView->PrintSource( pOutDev, nRenderer + 1, false ); } - // <-- - - const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions(); - if (bPrintProspect) - pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); - else // normal printing and PDF export - pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer ); - - // --> FME 2004-10-08 #i35176# - // - // After printing the last page, we take care for the links coming - // from the EditEngine. The links are generated during the painting - // process, but the destinations are still missing. - // - if (bIsPDFExport && bLastPage && pWrtShell) + else { - SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); - } - // <-- + // the view shell should be SwView for documents PDF export + // or SwPagePreView for PDF export of the page preview + //!! (check for SwView first as in GuessViewShell) !! + DBG_ASSERT( pView, "!! view missing !!" ); + const TypeId aSwViewTypeId = TYPE(SwView); + ViewShell* pVwSh = 0; + if (pView) + { + pVwSh = pView->IsA(aSwViewTypeId) ? + ((SwView*)pView)->GetWrtShellPtr() : + ((SwPagePreView*)pView)->GetViewShell(); + } - pVwSh->SetPDFExportOption( sal_False ); + // get output device to use + OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); - // last page to be rendered? (not necessarily the last page of the document) - // -> do clean-up of data - if (bLastPage) - { - // #i96167# haggai: delete pViewOptionsAdjust here because it makes use - // of the shell, which might get destroyed in lcl_DisposeView! - if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) - m_pRenderData->ViewOptionAdjustStop(); - - if (m_pRenderData && m_pRenderData->HasPostItData()) - m_pRenderData->DeletePostItData(); - if (m_pHiddenViewFrame) + if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) { - lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); - m_pHiddenViewFrame = 0; - } + const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); + const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); + + DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) + || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), + "SwView / SwViewOptionAdjust_Impl availability mismatch" ); + + // since printing now also use the API for PDF export this option + // should be set for printing as well ... + pVwSh->SetPDFExportOption( sal_True ); + + // --> FME 2004-06-08 #i12836# enhanced pdf export + // + // First, we have to export hyperlinks, notes, and outline to pdf. + // During this process, additional information required for tagging + // the pdf file are collected, which are evaulated during painting. + // + SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ? + ((SwView*)pView)->GetWrtShellPtr() : + 0; + + if (bIsPDFExport && bFirstPage && pWrtShell) + { + SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); + } + // <-- + + const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions(); + if (bPrintProspect) + pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); + else // normal printing and PDF export + pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer ); + + // --> FME 2004-10-08 #i35176# + // + // After printing the last page, we take care for the links coming + // from the EditEngine. The links are generated during the painting + // process, but the destinations are still missing. + // + if (bIsPDFExport && bLastPage && pWrtShell) + { + SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); + } + // <-- + + pVwSh->SetPDFExportOption( sal_False ); - delete m_pRenderData; m_pRenderData = NULL; - delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; + // last page to be rendered? (not necessarily the last page of the document) + // -> do clean-up of data + if (bLastPage) + { + // #i96167# haggai: delete pViewOptionsAdjust here because it makes use + // of the shell, which might get destroyed in lcl_DisposeView! + if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) + m_pRenderData->ViewOptionAdjustStop(); + + if (m_pRenderData && m_pRenderData->HasPostItData()) + m_pRenderData->DeletePostItData(); + if (m_pHiddenViewFrame) + { + lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); + m_pHiddenViewFrame = 0; + } + } + } } } } + if( bLastPage ) + { + delete m_pRenderData; m_pRenderData = NULL; + delete m_pPrintUIOptions; m_pPrintUIOptions = NULL; + } } /* -----------------------------03.10.04 ------------------------------------- -- cgit v1.2.3 From 6c5d7c1a2c9932974f17fb36ed12f467590d220e Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 9 Oct 2009 13:29:07 +0200 Subject: fix an erroneously committed merge conflict --- starmath/source/unomodel.cxx | 1007 ------------------------------------------ 1 file changed, 1007 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 828dec857c9c..0e37f853c164 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1,4 +1,3 @@ -<<<<<<< local /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1129,1009 +1128,3 @@ void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xPare } } -======= -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unomodel.cxx,v $ - * $Revision: 1.49 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_starmath.hxx" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef STARMATH_HRC -#include -#endif -#include - -#include - -using namespace ::vos; -using namespace ::rtl; -using namespace ::cppu; -using namespace ::std; -using namespace ::comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::formula; -using namespace ::com::sun::star::view; -using namespace ::com::sun::star::script; - -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - - -//////////////////////////////////////// -// -// class SmModel -// -#define PROPERTY_NONE 0 -enum SmModelPropertyHandles -{ - HANDLE_FORMULA, - HANDLE_FONT_NAME_VARIABLES, - HANDLE_FONT_NAME_FUNCTIONS, - HANDLE_FONT_NAME_NUMBERS, - HANDLE_FONT_NAME_TEXT, - HANDLE_CUSTOM_FONT_NAME_SERIF, - HANDLE_CUSTOM_FONT_NAME_SANS, - HANDLE_CUSTOM_FONT_NAME_FIXED, - HANDLE_CUSTOM_FONT_FIXED_POSTURE, - HANDLE_CUSTOM_FONT_FIXED_WEIGHT, - HANDLE_CUSTOM_FONT_SANS_POSTURE, - HANDLE_CUSTOM_FONT_SANS_WEIGHT, - HANDLE_CUSTOM_FONT_SERIF_POSTURE, - HANDLE_CUSTOM_FONT_SERIF_WEIGHT, - HANDLE_FONT_VARIABLES_POSTURE, - HANDLE_FONT_VARIABLES_WEIGHT, - HANDLE_FONT_FUNCTIONS_POSTURE, - HANDLE_FONT_FUNCTIONS_WEIGHT, - HANDLE_FONT_NUMBERS_POSTURE, - HANDLE_FONT_NUMBERS_WEIGHT, - HANDLE_FONT_TEXT_POSTURE, - HANDLE_FONT_TEXT_WEIGHT, - HANDLE_BASE_FONT_HEIGHT, - HANDLE_RELATIVE_FONT_HEIGHT_TEXT, - HANDLE_RELATIVE_FONT_HEIGHT_INDICES, - HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS, - HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS, - HANDLE_RELATIVE_FONT_HEIGHT_LIMITS, - HANDLE_IS_TEXT_MODE, - HANDLE_ALIGNMENT, - HANDLE_RELATIVE_SPACING, - HANDLE_RELATIVE_LINE_SPACING, - HANDLE_RELATIVE_ROOT_SPACING, - HANDLE_RELATIVE_INDEX_SUPERSCRIPT, - HANDLE_RELATIVE_INDEX_SUBSCRIPT, - HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT, - HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, - HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, - HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT, - HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE, - HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE, - HANDLE_RELATIVE_BRACKET_EXCESS_SIZE, - HANDLE_RELATIVE_BRACKET_DISTANCE, - HANDLE_IS_SCALE_ALL_BRACKETS, - HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE, - HANDLE_RELATIVE_MATRIX_LINE_SPACING, - HANDLE_RELATIVE_MATRIX_COLUMN_SPACING, - HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT, - HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT, - HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE, - HANDLE_RELATIVE_OPERATOR_SPACING, - HANDLE_LEFT_MARGIN, - HANDLE_RIGHT_MARGIN, - HANDLE_TOP_MARGIN, - HANDLE_BOTTOM_MARGIN, - HANDLE_PRINTER_NAME, - HANDLE_PRINTER_SETUP, - HANDLE_SYMBOLS, - HANDLE_BASIC_LIBRARIES, /* #93295# */ - HANDLE_RUNTIME_UID, - // --> PB 2004-08-25 #i33095# Security Options - HANDLE_LOAD_READONLY, - // <-- - HANDLE_DIALOG_LIBRARIES // #i73329# -}; - -PropertySetInfo * lcl_createModelPropertyInfo () -{ - static PropertyMapEntry aModelPropertyInfoMap[] = - { - { RTL_CONSTASCII_STRINGPARAM( "Alignment" ), HANDLE_ALIGNMENT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "BaseFontHeight" ), HANDLE_BASE_FONT_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "BasicLibraries" ), HANDLE_BASIC_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, - { RTL_CONSTASCII_STRINGPARAM( "BottomMargin" ), HANDLE_BOTTOM_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BOTTOMSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameFixed" ), HANDLE_CUSTOM_FONT_NAME_FIXED , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FIXED }, - { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSans" ), HANDLE_CUSTOM_FONT_NAME_SANS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SANS }, - { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSerif" ), HANDLE_CUSTOM_FONT_NAME_SERIF , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SERIF }, - { RTL_CONSTASCII_STRINGPARAM( "DialogLibraries" ), HANDLE_DIALOG_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, - { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsBold"), HANDLE_CUSTOM_FONT_FIXED_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, - { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsItalic"), HANDLE_CUSTOM_FONT_FIXED_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, - { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsBold"), HANDLE_FONT_FUNCTIONS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, - { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsItalic"), HANDLE_FONT_FUNCTIONS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, - { RTL_CONSTASCII_STRINGPARAM( "FontNameFunctions" ), HANDLE_FONT_NAME_FUNCTIONS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FUNCTION }, - { RTL_CONSTASCII_STRINGPARAM( "FontNameNumbers" ), HANDLE_FONT_NAME_NUMBERS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_NUMBER }, - { RTL_CONSTASCII_STRINGPARAM( "FontNameText" ), HANDLE_FONT_NAME_TEXT , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_TEXT }, - { RTL_CONSTASCII_STRINGPARAM( "FontNameVariables" ), HANDLE_FONT_NAME_VARIABLES , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_VARIABLE }, - { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsBold"), HANDLE_FONT_NUMBERS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, - { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsItalic"), HANDLE_FONT_NUMBERS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, - { RTL_CONSTASCII_STRINGPARAM( "FontSansIsBold"), HANDLE_CUSTOM_FONT_SANS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, - { RTL_CONSTASCII_STRINGPARAM( "FontSansIsItalic"), HANDLE_CUSTOM_FONT_SANS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, - { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsBold"), HANDLE_CUSTOM_FONT_SERIF_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, - { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsItalic"), HANDLE_CUSTOM_FONT_SERIF_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, - { RTL_CONSTASCII_STRINGPARAM( "FontTextIsBold"), HANDLE_FONT_TEXT_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, - { RTL_CONSTASCII_STRINGPARAM( "FontTextIsItalic"), HANDLE_FONT_TEXT_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, - { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsBold"), HANDLE_FONT_VARIABLES_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, - { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsItalic"), HANDLE_FONT_VARIABLES_POSTURE, &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, - { RTL_CONSTASCII_STRINGPARAM( "Formula" ), HANDLE_FORMULA , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "IsScaleAllBrackets" ), HANDLE_IS_SCALE_ALL_BRACKETS , &::getBooleanCppuType(), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "IsTextMode" ), HANDLE_IS_TEXT_MODE , &::getBooleanCppuType(), PROPERTY_NONE, 0}, - { RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ), HANDLE_LEFT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LEFTSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "PrinterName" ), HANDLE_PRINTER_NAME , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "PrinterSetup" ), HANDLE_PRINTER_SETUP , &::getCppuType((const Sequence < sal_Int8 >*)0), PROPERTY_NONE, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketDistance" ), HANDLE_RELATIVE_BRACKET_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketExcessSize" ), HANDLE_RELATIVE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSIZE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightFunctions" ), HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_FUNCTION}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightIndices" ), HANDLE_RELATIVE_FONT_HEIGHT_INDICES , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_INDEX }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightLimits" ), HANDLE_RELATIVE_FONT_HEIGHT_LIMITS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_LIMITS }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightOperators" ), HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_OPERATOR}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightText" ), HANDLE_RELATIVE_FONT_HEIGHT_TEXT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_TEXT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarExcessLength"), HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_FRACTION }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarLineWeight" ), HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_STROKEWIDTH }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionDenominatorDepth"), HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_DENOMINATOR }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionNumeratorHeight" ), HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NUMERATOR }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSubscript" ), HANDLE_RELATIVE_INDEX_SUBSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUBSCRIPT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSuperscript" ), HANDLE_RELATIVE_INDEX_SUPERSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUPERSCRIPT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeLineSpacing" ), HANDLE_RELATIVE_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_VERTICAL }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeLowerLimitDistance" ), HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LOWERLIMIT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixColumnSpacing" ), HANDLE_RELATIVE_MATRIX_COLUMN_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXCOL}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixLineSpacing" ), HANDLE_RELATIVE_MATRIX_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXROW}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorExcessSize" ), HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSIZE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorSpacing" ), HANDLE_RELATIVE_OPERATOR_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSPACE}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeRootSpacing" ), HANDLE_RELATIVE_ROOT_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ROOT }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeScaleBracketExcessSize" ), HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NORMALBRACKETSIZE}, - { RTL_CONSTASCII_STRINGPARAM( "RelativeSpacing" ), HANDLE_RELATIVE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_HORIZONTAL }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolMinimumHeight" ), HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolPrimaryHeight" ), HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSIZE }, - { RTL_CONSTASCII_STRINGPARAM( "RelativeUpperLimitDistance" ), HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_UPPERLIMIT }, - { RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE }, - { RTL_CONSTASCII_STRINGPARAM( "RuntimeUID" ), HANDLE_RUNTIME_UID , &::getCppuType(static_cast< const rtl::OUString * >(0)), PropertyAttribute::READONLY, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 }, - { RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE }, - // --> PB 2004-08-25 #i33095# Security Options - { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, - // <-- - { NULL, 0, 0, NULL, 0, 0 } - }; - PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap ); - return pInfo; -} -//----------------------------------------------------------------------- -SmModel::SmModel( SfxObjectShell *pObjSh ) -: SfxBaseModel(pObjSh) -, PropertySetHelper ( lcl_createModelPropertyInfo () ) -{ -} -//----------------------------------------------------------------------- -SmModel::~SmModel() throw () -{ -} -/*-- 28.03.00 14:18:17--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface ( rType, - // OWeakObject interfaces - dynamic_cast< XInterface* > ( static_cast< XUnoTunnel* > ( this )), - static_cast< XWeak* > ( this ), - // PropertySetHelper interfaces - static_cast< XPropertySet* > ( this ), - static_cast< XMultiPropertySet* > ( this ), - //static_cast< XPropertyState* > ( this ), - // my own interfaces - static_cast< XServiceInfo* > ( this ), - static_cast< XRenderable* > ( this ) ); - if (!aRet.hasValue()) - aRet = SfxBaseModel::queryInterface ( rType ); - return aRet; -} -/*-- 28.03.00 14:18:18--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SAL_CALL SmModel::acquire() throw() -{ - OWeakObject::acquire(); -} -/*-- 28.03.00 14:18:18--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SAL_CALL SmModel::release() throw() -{ - OWeakObject::release(); -} -/*-- 28.03.00 14:18:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( ) throw(uno::RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 4); - uno::Type* pTypes = aTypes.getArray(); - pTypes[nLen++] = ::getCppuType((Reference*)0); - pTypes[nLen++] = ::getCppuType((Reference*)0); - pTypes[nLen++] = ::getCppuType((Reference*)0); - pTypes[nLen++] = ::getCppuType((Reference*)0); - - // XPropertyState not supported?? (respective virtual functions from - // PropertySetHelper not overloaded) - //pTypes[nLen++] = ::getCppuType((Reference*)0); - - return aTypes; -} -/* -----------------------------28.03.00 14:23-------------------------------- - - ---------------------------------------------------------------------------*/ -const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() -{ - static osl::Mutex aCreateMutex; - osl::Guard aGuard( aCreateMutex ); - - static uno::Sequence< sal_Int8 > aSeq; - if(!aSeq.getLength()) - { - aSeq.realloc( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - } - return aSeq; -} /* -----------------------------28.03.00 14:23-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) - throw(uno::RuntimeException) -{ - if( rId.getLength() == 16 - && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - } - - return SfxBaseModel::getSomething( rId ); -} -/*-- 07.01.00 16:32:59--------------------------------------------------- - - -----------------------------------------------------------------------*/ -/*-- 07.01.00 16:33:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Int16 lcl_AnyToINT16(const uno::Any& rAny) -{ - uno::TypeClass eType = rAny.getValueType().getTypeClass(); - - sal_Int16 nRet = 0; - if( eType == uno::TypeClass_DOUBLE ) - nRet = (sal_Int16)*(double*)rAny.getValue(); - else if( eType == uno::TypeClass_FLOAT ) - nRet = (sal_Int16)*(float*)rAny.getValue(); - else - rAny >>= nRet; - return nRet; -} -//----------------------------------------------------------------------------- - -OUString SmModel::getImplementationName(void) throw( uno::RuntimeException ) -{ - return getImplementationName_Static(); -} - - -::rtl::OUString SmModel::getImplementationName_Static() -{ - return rtl::OUString::createFromAscii("com.sun.star.comp.math.FormulaDocument"); -} - -/*-- 20.01.04 11:21:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SmModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) -{ - return ( - rServiceName == A2OU("com.sun.star.document.OfficeDocument" ) || - rServiceName == A2OU("com.sun.star.formula.FormulaProperties") - ); -} -/*-- 20.01.04 11:21:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Sequence< OUString > SmModel::getSupportedServiceNames(void) throw( uno::RuntimeException ) -{ - return getSupportedServiceNames_Static(); -} - -uno::Sequence< OUString > SmModel::getSupportedServiceNames_Static(void) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - uno::Sequence< OUString > aRet(2); - OUString* pArray = aRet.getArray(); - pArray[0] = A2OU("com.sun.star.document.OfficeDocument"); - pArray[1] = A2OU("com.sun.star.formula.FormulaProperties"); - return aRet; -} - -void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pValues) - throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); - - if ( NULL == pDocSh ) - throw UnknownPropertyException(); - - SmFormat aFormat = pDocSh->GetFormat(); - - for (; *ppEntries; ppEntries++, pValues++ ) - { - if ((*ppEntries)->mnAttributes & PropertyAttribute::READONLY) - throw PropertyVetoException(); - - switch ( (*ppEntries)->mnHandle ) - { - case HANDLE_FORMULA: - { - OUString aText; - *pValues >>= aText; - pDocSh->SetText(aText); - } - break; - case HANDLE_FONT_NAME_VARIABLES : - case HANDLE_FONT_NAME_FUNCTIONS : - case HANDLE_FONT_NAME_NUMBERS : - case HANDLE_FONT_NAME_TEXT : - case HANDLE_CUSTOM_FONT_NAME_SERIF : - case HANDLE_CUSTOM_FONT_NAME_SANS : - case HANDLE_CUSTOM_FONT_NAME_FIXED : - { - OUString aText; - *pValues >>= aText; - String sFontName = aText; - if(!sFontName.Len()) - throw IllegalArgumentException(); - - if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName) - { - const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId); - - SmFace aSet( sFontName, rOld.GetSize() ); - aSet.SetBorderWidth( rOld.GetBorderWidth() ); - aSet.SetAlign( ALIGN_BASELINE ); - aFormat.SetFont( (*ppEntries)->mnMemberId, aSet ); - } - } - break; - case HANDLE_CUSTOM_FONT_FIXED_POSTURE: - case HANDLE_CUSTOM_FONT_SANS_POSTURE : - case HANDLE_CUSTOM_FONT_SERIF_POSTURE: - case HANDLE_FONT_VARIABLES_POSTURE : - case HANDLE_FONT_FUNCTIONS_POSTURE : - case HANDLE_FONT_NUMBERS_POSTURE : - case HANDLE_FONT_TEXT_POSTURE : - { - if((*pValues).getValueType() != ::getBooleanCppuType()) - throw IllegalArgumentException(); - BOOL bVal = *(sal_Bool*)(*pValues).getValue(); - Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); - aNewFont.SetItalic((bVal) ? ITALIC_NORMAL : ITALIC_NONE); - aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); - } - break; - case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : - case HANDLE_CUSTOM_FONT_SANS_WEIGHT : - case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : - case HANDLE_FONT_VARIABLES_WEIGHT : - case HANDLE_FONT_FUNCTIONS_WEIGHT : - case HANDLE_FONT_NUMBERS_WEIGHT : - case HANDLE_FONT_TEXT_WEIGHT : - { - if((*pValues).getValueType() != ::getBooleanCppuType()) - throw IllegalArgumentException(); - BOOL bVal = *(sal_Bool*)(*pValues).getValue(); - Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); - aNewFont.SetWeight((bVal) ? WEIGHT_BOLD : WEIGHT_NORMAL); - aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); - } - break; - case HANDLE_BASE_FONT_HEIGHT : - { - // Point! - sal_Int16 nVal = lcl_AnyToINT16(*pValues); - if(nVal < 1) - throw IllegalArgumentException(); - Size aSize = aFormat.GetBaseSize(); - nVal *= 20; - nVal = static_cast < sal_Int16 > ( TWIP_TO_MM100(nVal) ); - aSize.Height() = nVal; - aFormat.SetBaseSize(aSize); - - // apply base size to fonts - const Size aTmp( aFormat.GetBaseSize() ); - for (USHORT i = FNT_BEGIN; i <= FNT_END; i++) - aFormat.SetFontSize(i, aTmp); - } - break; - case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : - case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : - case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : - case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : - case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : - { - sal_Int16 nVal = 0; - *pValues >>= nVal; - if(nVal < 1) - throw IllegalArgumentException(); - aFormat.SetRelSize((*ppEntries)->mnMemberId, nVal); - } - break; - - case HANDLE_IS_TEXT_MODE : - { - aFormat.SetTextmode(*(sal_Bool*)(*pValues).getValue()); - } - break; - - case HANDLE_ALIGNMENT : - { - // SmHorAlign uses the same values as HorizontalAlignment - sal_Int16 nVal = 0; - *pValues >>= nVal; - if(nVal < 0 || nVal > 2) - throw IllegalArgumentException(); - aFormat.SetHorAlign((SmHorAlign)nVal); - } - break; - - case HANDLE_RELATIVE_SPACING : - case HANDLE_RELATIVE_LINE_SPACING : - case HANDLE_RELATIVE_ROOT_SPACING : - case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : - case HANDLE_RELATIVE_INDEX_SUBSCRIPT : - case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : - case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: - case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: - case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : - case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_BRACKET_DISTANCE : - case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_MATRIX_LINE_SPACING : - case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : - case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : - case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : - case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : - case HANDLE_RELATIVE_OPERATOR_SPACING : - case HANDLE_LEFT_MARGIN : - case HANDLE_RIGHT_MARGIN : - case HANDLE_TOP_MARGIN : - case HANDLE_BOTTOM_MARGIN : - { - sal_Int16 nVal = 0; - *pValues >>= nVal; - if(nVal < 0) - throw IllegalArgumentException(); - aFormat.SetDistance((*ppEntries)->mnMemberId, nVal); - } - break; - case HANDLE_IS_SCALE_ALL_BRACKETS : - aFormat.SetScaleNormalBrackets(*(sal_Bool*)(*pValues).getValue()); - break; - case HANDLE_PRINTER_NAME: - { - // embedded documents just ignore this property for now - if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) - { - SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); - if (pPrinter) - { - OUString sPrinterName; - if (*pValues >>= sPrinterName ) - { - if ( sPrinterName.getLength() ) - { - SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); - if (pNewPrinter->IsKnown()) - pDocSh->SetPrinter ( pNewPrinter ); - else - delete pNewPrinter; - } - } - else - throw IllegalArgumentException(); - } - } - } - break; - case HANDLE_PRINTER_SETUP: - { - Sequence < sal_Int8 > aSequence; - if ( *pValues >>= aSequence ) - { - sal_uInt32 nSize = aSequence.getLength(); - SvMemoryStream aStream ( aSequence.getArray(), nSize, STREAM_READ ); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - static sal_uInt16 __READONLY_DATA nRange[] = - { - SID_PRINTSIZE, SID_PRINTSIZE, - SID_PRINTZOOM, SID_PRINTZOOM, - SID_PRINTTITLE, SID_PRINTTITLE, - SID_PRINTTEXT, SID_PRINTTEXT, - SID_PRINTFRAME, SID_PRINTFRAME, - SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, - 0 - }; - SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange ); - SmModule *pp = SM_MOD1(); - pp->GetConfig()->ConfigToItemSet(*pItemSet); - SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); - - pDocSh->SetPrinter( pPrinter ); - } - else - throw IllegalArgumentException(); - } - break; - case HANDLE_SYMBOLS: - { - // this is set - Sequence < SymbolDescriptor > aSequence; - if ( *pValues >>= aSequence ) - { - sal_uInt32 nSize = aSequence.getLength(); - SmModule *pp = SM_MOD1(); - SmSymSetManager &rManager = pp->GetSymSetManager(); - SymbolDescriptor *pDescriptor = aSequence.getArray(); - for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++) - { - Font aFont; - aFont.SetName ( pDescriptor->sFontName ); - aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) ); - aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) ); - aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) ); - aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) ); - aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) ); - SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter), - pDescriptor->sSymbolSet ); - aSymbol.SetExportName ( pDescriptor->sExportName ); - aSymbol.SetDocSymbol( TRUE ); - rManager.AddReplaceSymbol ( aSymbol ); - } - } - else - throw IllegalArgumentException(); - } - break; - // --> PB 2004-08-25 #i33095# Security Options - case HANDLE_LOAD_READONLY : - { - if ( (*pValues).getValueType() != ::getBooleanCppuType() ) - throw IllegalArgumentException(); - sal_Bool bReadonly = FALSE; - if ( *pValues >>= bReadonly ) - pDocSh->SetLoadReadonly( bReadonly ); - break; - } - // <-- - } - } - - pDocSh->SetFormat( aFormat ); - - // #i67283# since about all of the above changes are likely to change - // the formula size we have to recalculate the vis-area now - pDocSh->SetVisArea( Rectangle( Point(0, 0), pDocSh->GetSize() ) ); -} - -void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue ) - throw( UnknownPropertyException, WrappedTargetException ) -{ - SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); - - if ( NULL == pDocSh ) - throw UnknownPropertyException(); - - const SmFormat & aFormat = pDocSh->GetFormat(); - - for (; *ppEntries; ppEntries++, pValue++ ) - { - switch ( (*ppEntries)->mnHandle ) - { - case HANDLE_FORMULA: - *pValue <<= OUString(pDocSh->GetText()); - break; - case HANDLE_FONT_NAME_VARIABLES : - case HANDLE_FONT_NAME_FUNCTIONS : - case HANDLE_FONT_NAME_NUMBERS : - case HANDLE_FONT_NAME_TEXT : - case HANDLE_CUSTOM_FONT_NAME_SERIF : - case HANDLE_CUSTOM_FONT_NAME_SANS : - case HANDLE_CUSTOM_FONT_NAME_FIXED : - { - const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - *pValue <<= OUString(rFace.GetName()); - } - break; - case HANDLE_CUSTOM_FONT_FIXED_POSTURE: - case HANDLE_CUSTOM_FONT_SANS_POSTURE : - case HANDLE_CUSTOM_FONT_SERIF_POSTURE: - case HANDLE_FONT_VARIABLES_POSTURE : - case HANDLE_FONT_FUNCTIONS_POSTURE : - case HANDLE_FONT_NUMBERS_POSTURE : - case HANDLE_FONT_TEXT_POSTURE : - { - const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - BOOL bVal = IsItalic( rFace ); - (*pValue).setValue(&bVal, *(*ppEntries)->mpType); - } - break; - case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : - case HANDLE_CUSTOM_FONT_SANS_WEIGHT : - case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : - case HANDLE_FONT_VARIABLES_WEIGHT : - case HANDLE_FONT_FUNCTIONS_WEIGHT : - case HANDLE_FONT_NUMBERS_WEIGHT : - case HANDLE_FONT_TEXT_WEIGHT : - { - const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); - BOOL bVal = IsBold( rFace ); // bold? - (*pValue).setValue(&bVal, *(*ppEntries)->mpType); - } - break; - case HANDLE_BASE_FONT_HEIGHT : - { - // Point! - sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height()); - nVal = static_cast < sal_Int16 > (MM100_TO_TWIP(nVal)); - nVal = (nVal + 10) / 20; - *pValue <<= nVal; - } - break; - case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : - case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : - case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : - case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : - case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : - *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId); - break; - - case HANDLE_IS_TEXT_MODE : - { - sal_Bool bVal = aFormat.IsTextmode(); - (*pValue).setValue(&bVal, ::getBooleanCppuType()); - } - break; - - case HANDLE_ALIGNMENT : - // SmHorAlign uses the same values as HorizontalAlignment - *pValue <<= (sal_Int16)aFormat.GetHorAlign(); - break; - - case HANDLE_RELATIVE_SPACING : - case HANDLE_RELATIVE_LINE_SPACING : - case HANDLE_RELATIVE_ROOT_SPACING : - case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : - case HANDLE_RELATIVE_INDEX_SUBSCRIPT : - case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : - case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: - case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: - case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : - case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : - case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_BRACKET_DISTANCE : - case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : - case HANDLE_RELATIVE_MATRIX_LINE_SPACING : - case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : - case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : - case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : - case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : - case HANDLE_RELATIVE_OPERATOR_SPACING : - case HANDLE_LEFT_MARGIN : - case HANDLE_RIGHT_MARGIN : - case HANDLE_TOP_MARGIN : - case HANDLE_BOTTOM_MARGIN : - *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId); - break; - case HANDLE_IS_SCALE_ALL_BRACKETS : - { - sal_Bool bVal = aFormat.IsScaleNormalBrackets(); - (*pValue).setValue(&bVal, ::getBooleanCppuType()); - } - break; - case HANDLE_PRINTER_NAME: - { - SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); - *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString(); - } - break; - case HANDLE_PRINTER_SETUP: - { - SfxPrinter *pPrinter = pDocSh->GetPrinter (); - if (pPrinter) - { - SvMemoryStream aStream; - pPrinter->Store( aStream ); - aStream.Seek ( STREAM_SEEK_TO_END ); - sal_uInt32 nSize = aStream.Tell(); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - Sequence < sal_Int8 > aSequence ( nSize ); - aStream.Read ( aSequence.getArray(), nSize ); - *pValue <<= aSequence; - } - } - break; - case HANDLE_SYMBOLS: - { - // this is get - SmModule *pp = SM_MOD1(); - const SmSymSetManager &rManager = pp->GetSymSetManager(); - vector < const SmSym * > aVector; - - USHORT nCount = 0; - for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++) - { - const SmSym * pSymbol = rManager.GetSymbolByPos( i ); - if (pSymbol && !pSymbol->IsPredefined () ) - { - aVector.push_back ( pSymbol ); - nCount++; - } - } - Sequence < SymbolDescriptor > aSequence ( nCount ); - SymbolDescriptor * pDescriptor = aSequence.getArray(); - - vector ::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); - for(; aIter != aEnd; pDescriptor++, aIter++) - { - pDescriptor->sName = (*aIter)->GetName(); - pDescriptor->sExportName = (*aIter)->GetExportName(); - pDescriptor->sSymbolSet = (*aIter)->GetSetName(); - pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter()); - - Font rFont = (*aIter)->GetFace(); - pDescriptor->sFontName = rFont.GetName(); - pDescriptor->nCharSet = sal::static_int_cast< sal_Int16 >(rFont.GetCharSet()); - pDescriptor->nFamily = sal::static_int_cast< sal_Int16 >(rFont.GetFamily()); - pDescriptor->nPitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); - pDescriptor->nWeight = sal::static_int_cast< sal_Int16 >(rFont.GetWeight()); - pDescriptor->nItalic = sal::static_int_cast< sal_Int16 >(rFont.GetItalic()); - } - *pValue <<= aSequence; - } - break; - case HANDLE_BASIC_LIBRARIES: - *pValue <<= pDocSh->GetBasicContainer(); - break; - case HANDLE_DIALOG_LIBRARIES: - *pValue <<= pDocSh->GetDialogContainer(); - break; - case HANDLE_RUNTIME_UID: - *pValue <<= getRuntimeUID(); - break; - // --> PB 2004-08-25 #i33095# Security Options - case HANDLE_LOAD_READONLY : - { - *pValue <<= pDocSh->IsLoadReadonly(); - break; - } - // <-- - } - } -} - -////////////////////////////////////////////////////////////////////// - -sal_Int32 SAL_CALL SmModel::getRendererCount( - const uno::Any& /*rSelection*/, - const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) - throw (IllegalArgumentException, RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - return 1; -} - -uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( - sal_Int32 nRenderer, - const uno::Any& /*rSelection*/, - const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) - throw (IllegalArgumentException, RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - if (0 != nRenderer) - throw IllegalArgumentException(); - - SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); - if (!pDocSh) - throw RuntimeException(); - - SmPrinterAccess aPrinterAccess( *pDocSh ); - Printer *pPrinter = aPrinterAccess.GetPrinter(); - //Point aPrtPageOffset( pPrinter->GetPageOffset() ); - Size aPrtPaperSize ( pPrinter->GetPaperSize() ); - - // if paper size is 0 (usually if no 'real' printer is found), - // guess the paper size - if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) - aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MAP_100TH_MM); - awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() ); - - uno::Sequence< beans::PropertyValue > aRenderer(1); - PropertyValue &rValue = aRenderer.getArray()[0]; - rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); - rValue.Value <<= aPageSize; - - return aRenderer; -} - -void SAL_CALL SmModel::render( - sal_Int32 nRenderer, - const uno::Any& rSelection, - const uno::Sequence< beans::PropertyValue >& rxOptions ) - throw (IllegalArgumentException, RuntimeException) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - - if (0 != nRenderer) - throw IllegalArgumentException(); - - SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); - if (!pDocSh) - throw RuntimeException(); - - // get device to be rendered in - uno::Reference< awt::XDevice > xRenderDevice; - for (sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i) - { - if( rxOptions[i].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) - rxOptions[i].Value >>= xRenderDevice; - } - - if (xRenderDevice.is()) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; - - if (!pOut) - throw RuntimeException(); - - pOut->SetMapMode( MAP_100TH_MM ); - - uno::Reference< frame::XModel > xModel; - rSelection >>= xModel; - if (xModel == pDocSh->GetModel()) - { - //!! when called via API we may not have an active view - //!! thus we go and look for a view that can be used. - const TypeId aTypeId = TYPE( SmViewShell ); - SfxViewShell* pViewSh = SfxViewShell::GetFirst( &aTypeId, sal_False /* search non-visible views as well*/ ); - while (pViewSh && pViewSh->GetObjectShell() != pDocSh) - pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, sal_False /* search non-visible views as well*/ ); - SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh ); - DBG_ASSERT( pView, "SmModel::render : no SmViewShell found" ); - - if (pView) - { - SmPrinterAccess aPrinterAccess( *pDocSh ); - Printer *pPrinter = aPrinterAccess.GetPrinter(); - - Size aPrtPaperSize ( pPrinter->GetPaperSize() ); - Size aOutputSize ( pPrinter->GetOutputSize() ); - Point aPrtPageOffset( pPrinter->GetPageOffset() ); - - // no real printer ?? - if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) - { - aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MAP_100TH_MM); - // factors from Windows DIN A4 - aOutputSize = Size( (long)(aPrtPaperSize.Width() * 0.941), - (long)(aPrtPaperSize.Height() * 0.961)); - aPrtPageOffset = Point( (long)(aPrtPaperSize.Width() * 0.0250), - (long)(aPrtPaperSize.Height() * 0.0214)); - } - Point aZeroPoint; - Rectangle OutputRect( aZeroPoint, aOutputSize ); - - - // set minimum top and bottom border - if (aPrtPageOffset.Y() < 2000) - OutputRect.Top() += 2000 - aPrtPageOffset.Y(); - if ((aPrtPaperSize.Height() - (aPrtPageOffset.Y() + OutputRect.Bottom())) < 2000) - OutputRect.Bottom() -= 2000 - (aPrtPaperSize.Height() - - (aPrtPageOffset.Y() + OutputRect.Bottom())); - - // set minimum left and right border - if (aPrtPageOffset.X() < 2500) - OutputRect.Left() += 2500 - aPrtPageOffset.X(); - if ((aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())) < 1500) - OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() - - (aPrtPageOffset.X() + OutputRect.Right())); - - pView->Impl_Print( *pOut, PRINT_SIZE_NORMAL, - Rectangle( OutputRect ), Point() ); - } - } - } -} - -void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xParent) - throw( lang::NoSupportException, uno::RuntimeException ) -{ - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - SfxBaseModel::setParent( xParent ); - uno::Reference< lang::XUnoTunnel > xParentTunnel( xParent, uno::UNO_QUERY ); - if ( xParentTunnel.is() ) - { - SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID ); - SfxObjectShell* pDoc = reinterpret_cast(xParentTunnel->getSomething( - uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) ); - if ( pDoc ) - GetObjectShell()->OnDocumentPrinterChanged( pDoc->GetDocumentPrinter() ); - } -} - ->>>>>>> other -- cgit v1.2.3 From 1f8c7028f642e995945eb0d3f70a13ac5267aad1 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 12 Oct 2009 11:36:38 +0200 Subject: solve rebase problems --- sw/inc/printdata.hxx | 2 +- sw/sdi/swriter.sdi | 25 ------------------------- sw/source/core/doc/doc.cxx | 12 +++++++----- sw/source/ui/uno/unomod.cxx | 2 +- 4 files changed, 9 insertions(+), 32 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 11e2deed24ba..1d7841953edc 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -284,7 +284,7 @@ public: void SetPrintEmptyPages(sal_Bool b ) { doSetModified(); bPrintEmptyPages = b;} void SetPrintPostIts ( sal_Int16 n){ doSetModified(); nPrintPostIts = n; } void SetPrintProspect ( sal_Bool b ) { doSetModified(); bPrintProspect = b; } - void SetPrintProspect_RTL ( sal_Bool b ) { doSetModified(); bPrintProspect_RTL = b; } + void SetPrintProspect_RTL ( sal_Bool b ) { doSetModified(); bPrintProspectRTL = b; } void SetPrintPageBackground(sal_Bool b){ doSetModified(); bPrintPageBackground = b;} void SetPrintBlackFont(sal_Bool b){ doSetModified(); bPrintBlackFont = b;} void SetPrintSingleJobs(sal_Bool b){ doSetModified(); bPrintSingleJobs = b;} diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 315d34197715..aede24688e1e 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -6508,31 +6508,6 @@ SfxVoidItem PageUpSel FN_PAGEUP_SEL GroupId = GID_NAVIGATOR; ] -//-------------------------------------------------------------------------- -SfxVoidItem PreviewPrintOptions FN_PREVIEW_PRINT_OPTIONS -() -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = TRUE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_DOC; -] - //-------------------------------------------------------------------------- SfxVoidItem PreviewZoom FN_PREVIEW_ZOOM ( SfxUInt16Item PreviewZoom FN_PREVIEW_ZOOM ) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 51115501c91a..6750dd266080 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -1116,7 +1117,7 @@ static void lcl_FormatPostIt( if (bNewPage) { - pIDCO->Insert( aPam, SvxFmtBreakItem( SVX_BREAK_PAGE_AFTER, RES_BREAK ), 0 ); + pIDCO->InsertPoolItem( aPam, SvxFmtBreakItem( SVX_BREAK_PAGE_AFTER, RES_BREAK ), 0 ); pIDCO->SplitNode( *aPam.GetPoint(), false ); } else if (!bIsFirstPostIt) @@ -1142,8 +1143,9 @@ static void lcl_FormatPostIt( aStr.AppendAscii(sTmp); aStr += pField->GetPar1(); aStr += ' '; - aStr += GetAppLocaleData().getDate( pField->GetDate() ); - pIDCO->Insert( aPam, aStr, true ); + SvtSysLocale aSysLocale; + aStr += /*(LocaleDataWrapper&)*/aSysLocale.GetLocaleData().getDate( pField->GetDate() ); + pIDCO->InsertString( aPam, aStr ); pIDCO->SplitNode( *aPam.GetPoint(), false ); aStr = pField->GetPar2(); @@ -1151,7 +1153,7 @@ static void lcl_FormatPostIt( // Bei Windows und Co alle CR rausschmeissen aStr.EraseAllChars( '\r' ); #endif - pIDCO->Insert( aPam, aStr, true ); + pIDCO->InsertString( aPam, aStr ); } @@ -1324,7 +1326,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( aPam.Move( fnMoveBackward, fnGoDoc ); aPam.SetMark(); aPam.Move( fnMoveForward, fnGoDoc ); - rData.m_pPostItDoc->Delete( aPam ); + rData.m_pPostItDoc->DeleteRange( aPam ); const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx index bfdb2b1d2460..b701edd514e0 100644 --- a/sw/source/ui/uno/unomod.cxx +++ b/sw/source/ui/uno/unomod.cxx @@ -576,7 +576,7 @@ void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, break; case HANDLE_PRINTSET_PROSPECT_RTL: { - rValue <<= mpPrtOpt->IsPrintProspect_RTL(); + rValue <<= mpPrtOpt->IsPrintProspectRTL(); } break; case HANDLE_PRINTSET_PLACEHOLDER: -- cgit v1.2.3 From 021c0f0b52d7893d9497a509d3eb70b5777e1406 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 14 Oct 2009 11:15:39 +0200 Subject: fix a windows build problem --- sw/inc/unotxdoc.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 4f2c444195d7..bea720e592bf 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -258,7 +258,7 @@ public: virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException); - SW_DLLPUBLIC static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); //XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException); -- cgit v1.2.3 From d697a028c4796e00afd2cfdef6e246c80c560749 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 16 Oct 2009 15:26:42 +0200 Subject: #i105860# allow choice between selection and whole document when printing directly --- sw/source/core/view/vprint.cxx | 1 + sw/source/ui/uiview/viewprt.cxx | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ec58b1dc7927..eafa9b8462c9 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -335,6 +335,7 @@ void SwRenderData::MakeSwPrtOptions( rOptions.bPrintHiddenText = pOpt->getBoolValue( "PrintHiddenText", rOptions.bPrintHiddenText ); rOptions.bPrintTextPlaceholder = pOpt->getBoolValue( "PrintTextPlaceholder", rOptions.bPrintTextPlaceholder ); rOptions.nPrintPostIts = static_cast< sal_Int16 >(pOpt->getIntValue( "PrintAnnotationMode", rOptions.nPrintPostIts )); + rOptions.bPrintSelection |= pOpt->getBoolValue( "PrintSelectionOnly", false ); //! needs to be set after MakeOptions since the assignment operation in that //! function will destroy the pointers diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 485799b28b00..2f78c63b285b 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -270,6 +270,7 @@ void __EXPORT SwView::ExecutePrint(SfxRequest& rReq) rReq.RemoveItem(FN_QRY_MERGE); BOOL bFromMerge = pPrintFromMergeItem ? pPrintFromMergeItem->GetValue() : FALSE; SwMiscConfig aMiscConfig; + bool bPrintSelection = false; if(!bSilent && !bFromMerge && SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) { @@ -284,12 +285,29 @@ void __EXPORT SwView::ExecutePrint(SfxRequest& rReq) return; } } + else if( rReq.GetSlot() == SID_PRINTDOCDIRECT && ! bSilent ) + { + if( /*!bIsAPI && */ + ( pSh->IsSelection() || pSh->IsFrmSelected() || pSh->IsObjSelected() ) ) + { + short nBtn = SvxPrtQryBox(&GetEditWin()).Execute(); + if( RET_CANCEL == nBtn ) + return;; + + if( RET_OK == nBtn ) + bPrintSelection = true; + } + } + //#i61455# if master documentes are printed silently without loaded links then update the links now if( bSilent && pSh->IsGlobalDoc() && !pSh->IsGlblDocSaveLinks() ) { pSh->GetLinkManager().UpdateAllLinks( sal_False, sal_False, sal_False, 0 ); } - SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() ); + SfxRequest aReq( rReq ); + SfxBoolItem aBool(SID_SELECTION, bPrintSelection); + aReq.AppendItem( aBool ); + SfxViewShell::ExecuteSlot( aReq, SfxViewShell::GetInterface() ); return; } default: -- cgit v1.2.3 From 5a6b0cd17195ce1b0fbe9e020d7972c2e708a95d Mon Sep 17 00:00:00 2001 From: tl93732 Date: Tue, 20 Oct 2009 13:05:12 +0200 Subject: #i105730# selection printing --- sw/source/core/view/vprint.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index eafa9b8462c9..ec58b1dc7927 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -335,7 +335,6 @@ void SwRenderData::MakeSwPrtOptions( rOptions.bPrintHiddenText = pOpt->getBoolValue( "PrintHiddenText", rOptions.bPrintHiddenText ); rOptions.bPrintTextPlaceholder = pOpt->getBoolValue( "PrintTextPlaceholder", rOptions.bPrintTextPlaceholder ); rOptions.nPrintPostIts = static_cast< sal_Int16 >(pOpt->getIntValue( "PrintAnnotationMode", rOptions.nPrintPostIts )); - rOptions.bPrintSelection |= pOpt->getBoolValue( "PrintSelectionOnly", false ); //! needs to be set after MakeOptions since the assignment operation in that //! function will destroy the pointers -- cgit v1.2.3 From fd67b046624ff95b39950b8af30ad3ff90d26fe8 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 20 Oct 2009 15:26:15 +0200 Subject: #i105730# comment edit --- sw/source/core/doc/doc.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) mode change 100644 => 100755 sw/source/core/doc/doc.cxx diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx old mode 100644 new mode 100755 index 6750dd266080..9b736d851381 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1283,11 +1283,22 @@ void SwDoc::CalculatePagesForPrinting( else { // PageContent : - // 0 -> print all pages + // 0 -> print all pages (default if aPageRange is empty) // 1 -> print range according to PageRange // 2 -> print selection - if (1 == rOptions.getIntValue( "PrintContent", 0 )) + const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + if (1 == nContent) aPageRange = rOptions.getStringValue( "PageRange", OUString() ); + if (2 == nContent) + { + // note that printing selections is actually implemented by copying + // the selection to a new temporary document and printing all of that one. + // Thus for Writer "PrintContent" must never be 2. + // See SwXTextDocument::GetRenderDoc for evaluating if a selection is to be + // printed and for creating the temporary document. + } + + // please note } if (aPageRange.getLength() == 0) // empty string -> print all { -- cgit v1.2.3 From 0eb60a412f3ba46dd33915a3aaadd01d31717b8b Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 23 Oct 2009 09:46:03 +0200 Subject: step 0 of an UNOization of the css.form.(X)FormController implementation: move the API to css.form.runtime, so we can later add new API chunks without breaking compatibility of the existing API in css.form --- sw/source/filter/html/htmlform.cxx | 3 +++ sw/source/ui/inc/unotxvw.hxx | 2 +- sw/source/ui/uno/unotxvw.cxx | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index dd93a4e60b92..3a17ba7c257e 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -76,6 +76,9 @@ #include #include #include +#include +#include +#include #include #include #include diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx index 4db18720cf87..5900eeb42638 100644 --- a/sw/source/ui/inc/unotxvw.hxx +++ b/sw/source/ui/inc/unotxvw.hxx @@ -109,7 +109,7 @@ public: virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener) throw( ::com::sun::star::uno::RuntimeException ); // XFormLayerAccess - virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > SAL_CALL getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& Form ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& Form ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isFormDesignMode( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode ) throw (::com::sun::star::uno::RuntimeException); diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index 6197bb489d61..9c7df7ecb479 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -721,7 +721,7 @@ uno::Reference< awt::XControl > SwXTextView::getControl(const uno::Reference< a /*-- 08.03.07 13:55------------------------------------------------------ -----------------------------------------------------------------------*/ -uno::Reference< form::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException) +uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -731,7 +731,7 @@ uno::Reference< form::XFormController > SAL_CALL SwXTextView::getFormController( Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL; DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" ); - uno::Reference< form::XFormController > xController; + uno::Reference< form::runtime::XFormController > xController; if ( pFormShell && pDrawView && pWindow ) xController = pFormShell->GetFormController( _Form, *pDrawView, *pWindow ); return xController; -- cgit v1.2.3 From c635b740e00d1762c905cdd787fdb31753dab932 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 30 Oct 2009 17:42:00 +0100 Subject: #i105295#: fix various uninitialized variables reported by valgrind in: SwTxtFormatter::CtorInitTxtFormatter(), SwArrowPortion::SwArrowPortion(), SwAccessiblePage::SwAccessiblePage(), SwXShape::_AdjustPositionProperties(), SwFrm::SwFrm(), SwGlosDocShell::SwGlosDocShell(), SwXPrintSettings::_getSingleValue() --- sw/source/core/access/accpage.cxx | 5 +++-- sw/source/core/layout/wsfrm.cxx | 5 +++++ sw/source/core/text/itrform2.cxx | 1 + sw/source/core/text/porrst.cxx | 1 + sw/source/core/unocore/unodraw.cxx | 24 ++++++++++++++---------- sw/source/ui/misc/glshell.cxx | 8 ++++---- sw/source/ui/uno/unomod.cxx | 32 +++++++++++++------------------- 7 files changed, 41 insertions(+), 35 deletions(-) diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx index 9d1f39acfc5b..bc2a74809420 100644 --- a/sw/source/core/access/accpage.cxx +++ b/sw/source/core/access/accpage.cxx @@ -129,8 +129,9 @@ void SwAccessiblePage::_InvalidateFocus() } SwAccessiblePage::SwAccessiblePage( SwAccessibleMap* pInitMap, - const SwFrm* pFrame ) : - SwAccessibleContext( pInitMap, AccessibleRole::PANEL, pFrame ) + const SwFrm* pFrame ) + : SwAccessibleContext( pInitMap, AccessibleRole::PANEL, pFrame ) + , bIsSelected( sal_False ) { DBG_ASSERT( pFrame != NULL, "need frame" ); DBG_ASSERT( pInitMap != NULL, "need map" ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index af97063da6e3..9225942c5f93 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -101,6 +101,11 @@ SwFrm::SwFrm( SwModify *pMod ) : pNext( 0 ), pPrev( 0 ), pDrawObjs( 0 ) + , bInfBody( FALSE ) + , bInfTab ( FALSE ) + , bInfFly ( FALSE ) + , bInfFtn ( FALSE ) + , bInfSct ( FALSE ) { #ifndef PRODUCT bFlag01 = bFlag02 = bFlag03 = bFlag04 = bFlag05 = 0; diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index cb54872d19e2..dc02f416de0c 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -101,6 +101,7 @@ void SwTxtFormatter::CtorInitTxtFormatter( SwTxtFrm *pNewFrm, SwTxtFormatInfo *p pMulti = NULL; bOnceMore = sal_False; + bFlyInCntBase = sal_False; bChanges = sal_False; bTruncLines = sal_False; nCntEndHyph = 0; diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index a0b859cf0e12..fe39264e416b 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -219,6 +219,7 @@ SwArrowPortion::SwArrowPortion( const SwTxtPaintInfo &rInf ) rInf.GetTxtFrm()->Prt().Right(); aPos.Y() = rInf.GetTxtFrm()->Frm().Top() + rInf.GetTxtFrm()->Prt().Bottom(); + SetWhichPor( POR_ARROW ); } void SwArrowPortion::Paint( const SwTxtPaintInfo &rInf ) const diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 11b3eae5a16a..b9e537279ada 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2739,12 +2739,14 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) rtl::OUString aHoriOrientPropStr( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ); uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) ); sal_Int16 eHoriOrient; - aHoriOrient >>= eHoriOrient; - if ( eHoriOrient != text::HoriOrientation::NONE ) + if (aHoriOrient >>= eHoriOrient) // may be void { - eHoriOrient = text::HoriOrientation::NONE; - aHoriOrient <<= eHoriOrient; - setPropertyValue( aHoriOrientPropStr, aHoriOrient ); + if ( eHoriOrient != text::HoriOrientation::NONE ) + { + eHoriOrient = text::HoriOrientation::NONE; + aHoriOrient <<= eHoriOrient; + setPropertyValue( aHoriOrientPropStr, aHoriOrient ); + } } // set x-position attribute aHoriPos <<= _aPosition.X; @@ -2767,12 +2769,14 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) rtl::OUString aVertOrientPropStr( RTL_CONSTASCII_USTRINGPARAM("VertOrient") ); uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) ); sal_Int16 eVertOrient; - aVertOrient >>= eVertOrient; - if ( eVertOrient != text::VertOrientation::NONE ) + if (aVertOrient >>= eVertOrient) // may be void { - eVertOrient = text::VertOrientation::NONE; - aVertOrient <<= eVertOrient; - setPropertyValue( aVertOrientPropStr, aVertOrient ); + if ( eVertOrient != text::VertOrientation::NONE ) + { + eVertOrient = text::VertOrientation::NONE; + aVertOrient <<= eVertOrient; + setPropertyValue( aVertOrientPropStr, aVertOrient ); + } } // set y-position attribute aVertPos <<= _aPosition.Y; diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index a79e67eec31c..402d6306784c 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -154,10 +154,10 @@ BOOL lcl_Save( SwWrtShell& rSh, const String& rGroupName, --------------------------------------------------------------------*/ -SwGlosDocShell::SwGlosDocShell( sal_Bool bNewShow) - : - SwDocShell( bShow ? SFX_CREATE_MODE_STANDARD : SFX_CREATE_MODE_INTERNAL ) - ,bShow ( bNewShow ) +SwGlosDocShell::SwGlosDocShell(sal_Bool bNewShow) + : SwDocShell( (bNewShow) + ? SFX_CREATE_MODE_STANDARD : SFX_CREATE_MODE_INTERNAL ) + , bShow ( bNewShow ) { SetHelpId(SW_GLOSDOCSHELL); } diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx index bfdb2b1d2460..6a67cb3dee29 100644 --- a/sw/source/ui/uno/unomod.cxx +++ b/sw/source/ui/uno/unomod.cxx @@ -519,58 +519,54 @@ void SwXPrintSettings::_preGetValues () void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue ) throw(UnknownPropertyException, WrappedTargetException ) { - sal_Bool bBool = TRUE; - sal_Bool bBoolVal; switch( rInfo.mnHandle ) { case HANDLE_PRINTSET_LEFT_PAGES: - bBoolVal = mpPrtOpt->IsPrintLeftPage(); + rValue <<= mpPrtOpt->IsPrintLeftPage(); break; case HANDLE_PRINTSET_RIGHT_PAGES: - bBoolVal = mpPrtOpt->IsPrintRightPage(); + rValue <<= mpPrtOpt->IsPrintRightPage(); break; case HANDLE_PRINTSET_REVERSED: - bBoolVal = mpPrtOpt->IsPrintReverse(); + rValue <<= mpPrtOpt->IsPrintReverse(); break; case HANDLE_PRINTSET_PROSPECT: - bBoolVal = mpPrtOpt->IsPrintProspect(); + rValue <<= mpPrtOpt->IsPrintProspect(); break; case HANDLE_PRINTSET_GRAPHICS: - bBoolVal = mpPrtOpt->IsPrintGraphic(); + rValue <<= mpPrtOpt->IsPrintGraphic(); break; case HANDLE_PRINTSET_TABLES: - bBoolVal = mpPrtOpt->IsPrintTable(); + rValue <<= mpPrtOpt->IsPrintTable(); break; case HANDLE_PRINTSET_DRAWINGS: - bBoolVal = mpPrtOpt->IsPrintDraw(); + rValue <<= mpPrtOpt->IsPrintDraw(); break; case HANDLE_PRINTSET_CONTROLS: - bBoolVal = mpPrtOpt->IsPrintControl(); + rValue <<= mpPrtOpt->IsPrintControl(); break; case HANDLE_PRINTSET_PAGE_BACKGROUND: - bBoolVal = mpPrtOpt->IsPrintPageBackground(); + rValue <<= mpPrtOpt->IsPrintPageBackground(); break; case HANDLE_PRINTSET_BLACK_FONTS: - bBoolVal = mpPrtOpt->IsPrintBlackFont(); + rValue <<= mpPrtOpt->IsPrintBlackFont(); break; case HANDLE_PRINTSET_SINGLE_JOBS: - bBoolVal = mpPrtOpt->IsPrintSingleJobs(); + rValue <<= mpPrtOpt->IsPrintSingleJobs(); break; case HANDLE_PRINTSET_EMPTY_PAGES: - bBoolVal = mpPrtOpt->IsPrintEmptyPages(); + rValue <<= mpPrtOpt->IsPrintEmptyPages(); break; case HANDLE_PRINTSET_PAPER_FROM_SETUP: - bBoolVal = mpPrtOpt->IsPaperFromSetup(); + rValue <<= mpPrtOpt->IsPaperFromSetup(); break; case HANDLE_PRINTSET_ANNOTATION_MODE: { - bBool = FALSE; rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() ); } break; case HANDLE_PRINTSET_FAX_NAME : { - bBool = FALSE; rValue <<= mpPrtOpt->GetFaxName(); } break; @@ -592,8 +588,6 @@ void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, default: throw UnknownPropertyException(); } - if(bBool) - rValue.setValue(&bBoolVal, ::getBooleanCppuType()); } void SwXPrintSettings::_postGetValues () throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) -- cgit v1.2.3 From 296fef7e82f0bf842428eaa97dff207399dc563e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 2 Nov 2009 19:08:00 +0100 Subject: #i105745#: tools/stream.hxx: API change: make SvMemoryStream::GetSize() private introduce new public SvMemoryStream::GetEndOfData() --- sw/source/filter/rtf/rtfatr.cxx | 2 +- sw/source/ui/app/docsh2.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index fc60c857aedb..e699cd64f0cb 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -530,7 +530,7 @@ void OutRTF_SwFlyFrmFmt( SwRTFWriter& rRTFWrt ) rRTFWrt.SetStrm( *pSaveStrm ); // Stream-Pointer wieder zurueck - if( aTmpStrm.GetSize() ) // gibt es SWG spezifische Attribute ?? + if ( aTmpStrm.GetEndOfData() ) // gibt es SWG spezifische Attribute? { aTmpStrm.Seek( 0L ); rRTFWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << aTmpStrm << '}'; diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 3fd1e879b063..a967799be78e 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1134,7 +1134,7 @@ void SwDocShell::Execute(SfxRequest& rReq) xRef( pClipCntnr ); pClipCntnr->CopyAnyData( FORMAT_RTF, (sal_Char*) - pStrm->GetData(), pStrm->GetSize() ); + pStrm->GetData(), pStrm->GetEndOfData() ); pClipCntnr->CopyToClipboard( GetView()? (Window*)&GetView()->GetEditWin() : 0 ); delete pStrm; -- cgit v1.2.3 From a05cd16e2ae2cd433465088e97eb0291d4f99d80 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 12 Nov 2009 15:30:38 +0100 Subject: tl76: #i106815#: Math related changes because of the new OpenSymbol font --- starmath/inc/types.hxx | 102 +- starmath/source/format.cxx | 6 +- starmath/source/mathmlimport.cxx | 6378 +++++++++++++++++++------------------- starmath/source/node.cxx | 4 +- starmath/source/rect.cxx | 3 +- starmath/source/types.cxx | 214 +- 6 files changed, 3244 insertions(+), 3463 deletions(-) diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx index 3cf63b076391..be3db98dbd94 100644 --- a/starmath/inc/types.hxx +++ b/starmath/inc/types.hxx @@ -31,9 +31,9 @@ #define TYPES_HXX #include +#include -#define FONTNAME_MATH "StarSymbol" -#define FONTNAME_MATH2 "OpenSymbol" +#define FONTNAME_MATH "OpenSymbol" ///////////////////////////////////////////////////////////////// @@ -54,19 +54,8 @@ inline sal_Bool IsInPrivateUseArea( sal_Unicode cChar ) { return 0xE000 <= cChar inline sal_Bool IsGreekChar( sal_Unicode cChar ) { return 0x0370 <= cChar && cChar <= 0x03FF; } sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar ); -#ifdef TL_NOT_YET_USED -sal_Unicode ConvertUnicodeToMathPrivateUseArea( sal_Unicode cChar ); - -sal_Unicode ConvertMathToMathType( sal_Unicode cChar ); -sal_Unicode ConvertMathTypeToMath( sal_Unicode cChar ); -#endif //TL_NOT_YET_USED sal_Unicode ConvertMathToMathML( sal_Unicode cChar ); -#ifdef TL_NOT_YET_USED -sal_Unicode ConvertMathMLToMath( sal_Unicode cChar ); - -sal_Unicode GetTokenChar( sal_Unicode cChar, sal_Bool bConvertForExport ); -#endif //TL_NOT_YET_USED ///////////////////////////////////////////////////////////////// // enum definitions for characters from the 'StarSymbol' font @@ -84,14 +73,14 @@ enum MathSymbol MS_DRARROW = (sal_Unicode) 0x21D2, MS_DLARROW = (sal_Unicode) 0x21D0, MS_DLRARROW = (sal_Unicode) 0x21D4, - MS_UNDERBRACE = (sal_Unicode) 0xE081, - MS_OVERBRACE = (sal_Unicode) 0xE082, - MS_CIRC = (sal_Unicode) 0x00B0, + MS_OVERBRACE = (sal_Unicode) 0x23DE, + MS_UNDERBRACE = (sal_Unicode) 0x23DF, + MS_CIRC = (sal_Unicode) 0x2218, MS_ASSIGN = (sal_Unicode) 0x003D, MS_ERROR = (sal_Unicode) 0x00BF, MS_NEQ = (sal_Unicode) 0x2260, - MS_PLUS = (sal_Unicode) 0xE083, + MS_PLUS = (sal_Unicode) 0x002B, MS_MINUS = (sal_Unicode) 0x2212, MS_MULTIPLY = (sal_Unicode) 0x2217, MS_TIMES = (sal_Unicode) 0x00D7, @@ -107,23 +96,23 @@ enum MathSymbol MS_UNION = (sal_Unicode) 0x222A, MS_INTERSECT = (sal_Unicode) 0x2229, - MS_LT = (sal_Unicode) 0xE084, - MS_GT = (sal_Unicode) 0xE085, + MS_LT = (sal_Unicode) 0x003C, + MS_GT = (sal_Unicode) 0x003E, MS_LE = (sal_Unicode) 0x2264, MS_GE = (sal_Unicode) 0x2265, - MS_LESLANT = (sal_Unicode) 0xE086, - MS_GESLANT = (sal_Unicode) 0xE087, + MS_LESLANT = (sal_Unicode) 0x2A7D, + MS_GESLANT = (sal_Unicode) 0x2A7E, MS_LL = (sal_Unicode) 0x226A, MS_GG = (sal_Unicode) 0x226B, - MS_SIM = (sal_Unicode) 0x007E, + MS_SIM = (sal_Unicode) 0x223C, MS_SIMEQ = (sal_Unicode) 0x2243, MS_APPROX = (sal_Unicode) 0x2248, MS_DEF = (sal_Unicode) 0x225D, MS_EQUIV = (sal_Unicode) 0x2261, MS_PROP = (sal_Unicode) 0x221D, MS_PARTIAL = (sal_Unicode) 0x2202, - MS_SUBSET = (sal_Unicode) 0x2282, + MS_SUBSET = (sal_Unicode) 0x2282, MS_SUPSET = (sal_Unicode) 0x2283, MS_SUBSETEQ = (sal_Unicode) 0x2286, MS_SUPSETEQ = (sal_Unicode) 0x2287, @@ -143,70 +132,69 @@ enum MathSymbol MS_LINE = (sal_Unicode) 0x2223, MS_DLINE = (sal_Unicode) 0x2225, MS_ORTHO = (sal_Unicode) 0x22A5, - MS_DOTSLOW = (sal_Unicode) 0xE08B, + MS_DOTSLOW = (sal_Unicode) 0x2026, MS_DOTSAXIS = (sal_Unicode) 0x22EF, MS_DOTSVERT = (sal_Unicode) 0x22EE, MS_DOTSUP = (sal_Unicode) 0x22F0, MS_DOTSDOWN = (sal_Unicode) 0x22F1, MS_TRANSR = (sal_Unicode) 0x22B6, MS_TRANSL = (sal_Unicode) 0x22B7, - MS_RIGHTARROW = (sal_Unicode) 0xE08C, MS_BACKSLASH = (sal_Unicode) 0x2216, MS_NEG = (sal_Unicode) 0x00AC, + MS_FORALL = (sal_Unicode) 0x2200, + MS_NABLA = (sal_Unicode) 0x2207, + MS_PROD = (sal_Unicode) 0x220F, + MS_COPROD = (sal_Unicode) 0x2210, + MS_SUM = (sal_Unicode) 0x2211, + MS_SQRT = (sal_Unicode) 0x221A, MS_INT = (sal_Unicode) 0x222B, MS_IINT = (sal_Unicode) 0x222C, MS_IIINT = (sal_Unicode) 0x222D, MS_LINT = (sal_Unicode) 0x222E, MS_LLINT = (sal_Unicode) 0x222F, MS_LLLINT = (sal_Unicode) 0x2230, - MS_SQRT = (sal_Unicode) 0xE08D, - MS_COPROD = (sal_Unicode) 0x2210, - MS_PROD = (sal_Unicode) 0x220F, - MS_SUM = (sal_Unicode) 0x2211, - MS_NABLA = (sal_Unicode) 0x2207, - MS_FORALL = (sal_Unicode) 0x2200, - MS_HAT = (sal_Unicode) 0xE091, - MS_CHECK = (sal_Unicode) 0xE092, - MS_BREVE = (sal_Unicode) 0xE093, - MS_ACUTE = (sal_Unicode) 0xE094, - MS_GRAVE = (sal_Unicode) 0xE095, - MS_TILDE = (sal_Unicode) 0xE096, - MS_BAR = (sal_Unicode) 0xE097, - MS_VEC = (sal_Unicode) 0xE098, + MS_GRAVE = (sal_Unicode) 0x0300, + MS_ACUTE = (sal_Unicode) 0x0301, + MS_HAT = (sal_Unicode) 0x0302, + MS_TILDE = (sal_Unicode) 0x0303, + MS_BAR = (sal_Unicode) 0x0304, + MS_BREVE = (sal_Unicode) 0x0306, + MS_CIRCLE = (sal_Unicode) 0x030A, + MS_CHECK = (sal_Unicode) 0x030C, + MS_VEC = (sal_Unicode) 0x20D7, MS_DOT = (sal_Unicode) 0x02D9, MS_DDOT = (sal_Unicode) 0x00A8, - MS_DDDOT = (sal_Unicode) 0xE09B, - MS_CIRCLE = (sal_Unicode) 0x02DA, + MS_DDDOT = (sal_Unicode) 0x20DB, MS_AND = (sal_Unicode) 0x2227, MS_OR = (sal_Unicode) 0x2228, MS_NI = (sal_Unicode) 0x220B, MS_EMPTYSET = (sal_Unicode) 0x2205, - MS_LBRACE = (sal_Unicode) 0x007B, - MS_RBRACE = (sal_Unicode) 0x007D, - MS_LPARENT = (sal_Unicode) 0xE09E, - MS_RPARENT = (sal_Unicode) 0xE09F, - MS_LANGLE = (sal_Unicode) 0x2329, - MS_RANGLE = (sal_Unicode) 0x232A, + MS_LPARENT = (sal_Unicode) 0x0028, + MS_RPARENT = (sal_Unicode) 0x0029, MS_LBRACKET = (sal_Unicode) 0x005B, MS_RBRACKET = (sal_Unicode) 0x005D, - - MS_LDBRACKET = (sal_Unicode) 0x301A, - MS_RDBRACKET = (sal_Unicode) 0x301B, - MS_PLACE = (sal_Unicode) 0xE0AA, - + MS_LBRACE = (sal_Unicode) 0x007B, + MS_RBRACE = (sal_Unicode) 0x007D, MS_LCEIL = (sal_Unicode) 0x2308, - MS_LFLOOR = (sal_Unicode) 0x230A, MS_RCEIL = (sal_Unicode) 0x2309, + MS_LFLOOR = (sal_Unicode) 0x230A, MS_RFLOOR = (sal_Unicode) 0x230B, + MS_LANGLE = (sal_Unicode) 0x2329, + MS_RANGLE = (sal_Unicode) 0x232A, + MS_LDBRACKET = (sal_Unicode) 0x27E6, + MS_RDBRACKET = (sal_Unicode) 0x27E7, + + MS_PLACE = (sal_Unicode) 0x2751, - MS_HBAR = (sal_Unicode) 0x210F, MS_LAMBDABAR = (sal_Unicode) 0x019B, - MS_LEFTARROW = (sal_Unicode) 0xE0DB, - MS_UPARROW = (sal_Unicode) 0xE0DC, - MS_DOWNARROW = (sal_Unicode) 0xE0DD, + MS_HBAR = (sal_Unicode) 0x210F, + MS_LEFTARROW = (sal_Unicode) 0x2190, + MS_UPARROW = (sal_Unicode) 0x2191, + MS_RIGHTARROW = (sal_Unicode) 0x2192, + MS_DOWNARROW = (sal_Unicode) 0x2193, MS_SETN = (sal_Unicode) 0x2115, MS_SETZ = (sal_Unicode) 0x2124, MS_SETQ = (sal_Unicode) 0x211A, diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx index 9ecfd1720b1e..d859f208161a 100644 --- a/starmath/source/format.cxx +++ b/starmath/source/format.cxx @@ -49,7 +49,7 @@ static const USHORT aLatinDefFnts[FNT_END] = DEFAULTFONT_SERIF, // FNT_SERIF DEFAULTFONT_SANS, // FNT_SANS DEFAULTFONT_FIXED // FNT_FIXED - //StarSymbol, // FNT_MATH + //OpenSymbol, // FNT_MATH }; // CJK default-fonts @@ -65,7 +65,7 @@ static const USHORT aCJKDefFnts[FNT_END] = DEFAULTFONT_CJK_TEXT, // FNT_SERIF DEFAULTFONT_CJK_DISPLAY, // FNT_SANS DEFAULTFONT_CJK_TEXT // FNT_FIXED - //StarSymbol, // FNT_MATH + //OpenSymbol, // FNT_MATH }; // CTL default-fonts @@ -78,7 +78,7 @@ static const USHORT aCTLDefFnts[FNT_END] = DEFAULTFONT_CTL_TEXT, // FNT_SERIF DEFAULTFONT_CTL_TEXT, // FNT_SANS DEFAULTFONT_CTL_TEXT // FNT_FIXED - //StarSymbol, // FNT_MATH + //OpenSymbol, // FNT_MATH }; diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 1f7336db6d3c..22ba1b30dc94 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1,3189 +1,3189 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: x $ - * $Revision: 1.00 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_starmath.hxx" - -/*todo: Change characters and tcharacters to accumulate the characters together -into one string, xml parser hands them to us line by line rather than all in -one go*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "mathmlimport.hxx" -#include "mathtype.hxx" -#include -#include -#include -#include - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::document; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using namespace ::xmloff::token; - -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - -#define IMPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter") - -#undef WANTEXCEPT - -//////////////////////////////////////////////////////////// - -ULONG SmXMLImportWrapper::Import(SfxMedium &rMedium) -{ - ULONG nError = ERRCODE_SFX_DOLOADFAILED; - - uno::Reference xServiceFactory( - utl::getProcessServiceFactory()); - DBG_ASSERT(xServiceFactory.is(), "XMLReader::Read: got no service manager"); - if ( !xServiceFactory.is() ) - return nError; - - //Make a model component from our SmModel - uno::Reference< lang::XComponent > xModelComp( xModel, uno::UNO_QUERY ); - DBG_ASSERT( xModelComp.is(), "XMLReader::Read: got no model" ); - - // try to get an XStatusIndicator from the Medium - uno::Reference xStatusIndicator; - - sal_Bool bEmbedded = sal_False; - uno::Reference xTunnel; - xTunnel = uno::Reference (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - SmDocShell *pDocShell = pModel ? - static_cast(pModel->GetObjectShell()) : 0; - if (pDocShell) - { -// if (pDocShell->GetMedium()) - { - DBG_ASSERT( pDocShell->GetMedium() == &rMedium, - "different SfxMedium found" ); - - SfxItemSet* pSet = rMedium.GetItemSet(); - if (pSet) - { - const SfxUnoAnyItem* pItem = static_cast( - pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); - if (pItem) - pItem->GetValue() >>= xStatusIndicator; - } - } - - if ( SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() ) - bEmbedded = sal_True; - } - - comphelper::PropertyMapEntry aInfoMap[] = - { - { "PrivateData", sizeof("PrivateData")-1, 0, - &::getCppuType( (Reference *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "BaseURI", sizeof("BaseURI")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "StreamRelPath", sizeof("StreamRelPath")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "StreamName", sizeof("StreamName")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { NULL, 0, 0, NULL, 0, 0 } - }; - uno::Reference< beans::XPropertySet > xInfoSet( - comphelper::GenericPropertySet_CreateInstance( - new comphelper::PropertySetInfo( aInfoMap ) ) ); - - // Set base URI - OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") ); - xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL() ) ); - - sal_Int32 nSteps=3; - if ( !(rMedium.IsStorage())) - nSteps = 1; - - sal_Int32 nProgressRange(nSteps); - if (xStatusIndicator.is()) - { - xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)), - nProgressRange); - } - - nSteps=0; - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - if ( rMedium.IsStorage()) - { - // TODO/LATER: handle the case of embedded links gracefully - if ( bEmbedded ) // && !rMedium.GetStorage()->IsRoot() ) - { - OUString aName( RTL_CONSTASCII_USTRINGPARAM( "dummyObjName" ) ); - if ( rMedium.GetItemSet() ) - { - const SfxStringItem* pDocHierarchItem = static_cast( - rMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) ); - if ( pDocHierarchItem ) - aName = pDocHierarchItem->GetValue(); - } - - if ( aName.getLength() ) - { - sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")); - xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); - } - } - - sal_Bool bOASIS = ( SotStorage::GetVersion( rMedium.GetStorage() ) > SOFFICE_FILEFORMAT_60 ); - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - ULONG nWarn = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "meta.xml", "Meta.xml", - xServiceFactory, xInfoSet, - (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaImporter" - : "com.sun.star.comp.Math.XMLMetaImporter") ); - - if ( nWarn != ERRCODE_IO_BROKENPACKAGE ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - nWarn = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "settings.xml", 0, - xServiceFactory, xInfoSet, - (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsImporter" - : "com.sun.star.comp.Math.XMLSettingsImporter" ) ); - - if ( nWarn != ERRCODE_IO_BROKENPACKAGE ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - nError = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml", - xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter" ); - } - else - nError = ERRCODE_IO_BROKENPACKAGE; - } - else - nError = ERRCODE_IO_BROKENPACKAGE; - } - else - { - Reference xInputStream = - new utl::OInputStreamWrapper(rMedium.GetInStream()); - - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - nError = ReadThroughComponent( xInputStream, xModelComp, - xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter", FALSE ); - } - - if (xStatusIndicator.is()) - xStatusIndicator->end(); - return nError; -} - - -/// read a component (file + filter version) -ULONG SmXMLImportWrapper::ReadThroughComponent( - Reference xInputStream, - Reference xModelComponent, - Reference & rFactory, - Reference & rPropSet, - const sal_Char* pFilterName, - sal_Bool bEncrypted ) -{ - ULONG nError = ERRCODE_SFX_DOLOADFAILED; - DBG_ASSERT(xInputStream.is(), "input stream missing"); - DBG_ASSERT(xModelComponent.is(), "document missing"); - DBG_ASSERT(rFactory.is(), "factory missing"); - DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!"); - - // prepare ParserInputSrouce - xml::sax::InputSource aParserInput; - aParserInput.aInputStream = xInputStream; - - // get parser - Reference< xml::sax::XParser > xParser( - rFactory->createInstance( - OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), - UNO_QUERY ); - DBG_ASSERT( xParser.is(), "Can't create parser" ); - if ( !xParser.is() ) - return nError; - - Sequence aArgs( 1 ); - aArgs[0] <<= rPropSet; - - // get filter - Reference< xml::sax::XDocumentHandler > xFilter( - rFactory->createInstanceWithArguments( - OUString::createFromAscii(pFilterName), aArgs ), - UNO_QUERY ); - DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." ); - if ( !xFilter.is() ) - return nError; - - // connect parser and filter - xParser->setDocumentHandler( xFilter ); - - // connect model and filter - Reference < XImporter > xImporter( xFilter, UNO_QUERY ); - xImporter->setTargetDocument( xModelComponent ); - - // finally, parser the stream - try - { - xParser->parseStream( aParserInput ); - - uno::Reference xFilterTunnel; - xFilterTunnel = uno::Reference - ( xFilter, uno::UNO_QUERY ); - SmXMLImport *pFilter = reinterpret_cast< SmXMLImport * >( - sal::static_int_cast< sal_uIntPtr >( - xFilterTunnel->getSomething( SmXMLImport::getUnoTunnelId() ))); - if ( pFilter && pFilter->GetSuccess() ) - nError = 0; - } - catch( xml::sax::SAXParseException& r ) - { - // sax parser sends wrapped exceptions, - // try to find the original one - xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r); - sal_Bool bTryChild = sal_True; - - while( bTryChild ) - { - xml::sax::SAXException aTmp; - if ( aSaxEx.WrappedException >>= aTmp ) - aSaxEx = aTmp; - else - bTryChild = sal_False; - } - - packages::zip::ZipIOException aBrokenPackage; - if ( aSaxEx.WrappedException >>= aBrokenPackage ) - return ERRCODE_IO_BROKENPACKAGE; - - if ( bEncrypted ) - nError = ERRCODE_SFX_WRONGPASSWORD; - } - catch( xml::sax::SAXException& r ) - { - packages::zip::ZipIOException aBrokenPackage; - if ( r.WrappedException >>= aBrokenPackage ) - return ERRCODE_IO_BROKENPACKAGE; - - if ( bEncrypted ) - nError = ERRCODE_SFX_WRONGPASSWORD; - } - catch( packages::zip::ZipIOException& ) - { - nError = ERRCODE_IO_BROKENPACKAGE; - } - catch( io::IOException& ) - { - } - - return nError; -} - - -ULONG SmXMLImportWrapper::ReadThroughComponent( - const uno::Reference< embed::XStorage >& xStorage, - Reference xModelComponent, - const sal_Char* pStreamName, - const sal_Char* pCompatibilityStreamName, - Reference & rFactory, - Reference & rPropSet, - const sal_Char* pFilterName ) -{ - DBG_ASSERT(xStorage.is(), "Need storage!"); - DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!"); - - // open stream (and set parser input) - OUString sStreamName = OUString::createFromAscii(pStreamName); - uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY ); - if ( !xAccess->hasByName(sStreamName) || !xStorage->isStreamElement(sStreamName) ) - { - // stream name not found! Then try the compatibility name. - // do we even have an alternative name? - if ( pCompatibilityStreamName ) - sStreamName = OUString::createFromAscii(pCompatibilityStreamName); - } - - // get input stream - try - { - uno::Reference < io::XStream > xEventsStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ ); - - // determine if stream is encrypted or not - uno::Reference < beans::XPropertySet > xProps( xEventsStream, uno::UNO_QUERY ); - Any aAny = xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ) ); - sal_Bool bEncrypted = sal_False; - if ( aAny.getValueType() == ::getBooleanCppuType() ) - aAny >>= bEncrypted; - - // set Base URL - if ( rPropSet.is() ) - { - OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") ); - rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); - } - - - Reference < io::XInputStream > xStream = xEventsStream->getInputStream(); - return ReadThroughComponent( xStream, xModelComponent, rFactory, rPropSet, pFilterName, bEncrypted ); - } - catch ( packages::WrongPasswordException& ) - { - return ERRCODE_SFX_WRONGPASSWORD; - } - catch( packages::zip::ZipIOException& ) - { - return ERRCODE_IO_BROKENPACKAGE; - } - catch ( uno::Exception& ) - { - } - - return ERRCODE_SFX_DOLOADFAILED; -} - -//////////////////////////////////////////////////////////// - -SmXMLImport::SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - sal_uInt16 nImportFlags) -: SvXMLImport( xServiceFactory, nImportFlags ), - pPresLayoutElemTokenMap(0), - pPresLayoutAttrTokenMap(0), - pFencedAttrTokenMap(0), - pOperatorAttrTokenMap(0), - pAnnotationAttrTokenMap(0), - pPresElemTokenMap(0), - pPresScriptEmptyElemTokenMap(0), - pPresTableElemTokenMap(0), - pColorTokenMap(0), - bSuccess(sal_False) -{ -} - -const uno::Sequence< sal_Int8 > & SmXMLImport::getUnoTunnelId() throw() -{ - static uno::Sequence< sal_Int8 > * pSeq = 0; - if ( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if ( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -OUString SAL_CALL SmXMLImport_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLImporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLImport_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( IMPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLImport_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLImport(IMPORT_ALL); - return (cppu::OWeakObject*)new SmXMLImport(rSMgr, IMPORT_ALL); -} - -//////////////////////////////////////////////////////////// - -OUString SAL_CALL SmXMLImportMeta_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisMetaImporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLImportMeta_getSupportedServiceNames() -throw() -{ - const OUString aServiceName( IMPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLImportMeta_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) -throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_META ); - return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_META ); -} - -//////////////////////////////////////////////////////////// - -OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisSettingsImporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLImportSettings_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( IMPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_SETTINGS ); - return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_SETTINGS ); -} - -//////////////////////////////////////////////////////////// - -// XServiceInfo -// override empty method from parent class -rtl::OUString SAL_CALL SmXMLImport::getImplementationName() - throw(uno::RuntimeException) -{ - OUString aTxt; - switch( getImportFlags() ) - { - case IMPORT_META: - aTxt = SmXMLImportMeta_getImplementationName(); - break; - case IMPORT_SETTINGS: - aTxt = SmXMLImportSettings_getImplementationName(); - break; - case IMPORT_ALL: - default: - aTxt = SmXMLImport_getImplementationName(); - break; - } - return aTxt; -} - - -sal_Int64 SAL_CALL SmXMLImport::getSomething( - const uno::Sequence< sal_Int8 >&rId ) -throw(uno::RuntimeException) -{ - if ( rId.getLength() == 16 && - 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - - return SvXMLImport::getSomething( rId ); -} - -void SmXMLImport::endDocument(void) - throw(xml::sax::SAXException, uno::RuntimeException) -{ - //Set the resulted tree into the SmDocShell where it belongs - SmNode *pTree; - if (NULL != (pTree = GetTree())) - { - uno::Reference xModel = GetModel(); - uno::Reference xTunnel; - xTunnel = uno::Reference (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - if (pModel) - { - SmDocShell *pDocShell = - static_cast(pModel->GetObjectShell()); - pDocShell->SetFormulaTree(pTree); - if (0 == aText.Len()) //If we picked up no annotation text - { - //Make up some editable text - aText = pDocShell->GetText(); - pTree->CreateTextFromNode(aText); - aText.EraseTrailingChars(); - if ((aText.GetChar(0) == '{') && - (aText.GetChar(aText.Len()-1) == '}')) - { - aText.Erase(0,1); - aText.Erase(aText.Len()-1,1); - } - } - pDocShell->SetText( String() ); - - // Convert symbol names - SmParser &rParser = pDocShell->GetParser(); - BOOL bVal = rParser.IsImportSymbolNames(); - rParser.SetImportSymbolNames( TRUE ); - SmNode *pTmpTree = rParser.Parse( aText ); - aText = rParser.GetText(); - delete pTmpTree; - rParser.SetImportSymbolNames( bVal ); - - pDocShell->SetText( aText ); - } - DBG_ASSERT(pModel,"So there *was* a uno problem after all"); - - bSuccess = sal_True; - } - - SvXMLImport::endDocument(); -} - -//////////////////////////////////////////////////////////// - -class SmXMLImportContext: public SvXMLImportContext -{ -public: - SmXMLImportContext( SmXMLImport &rImport, sal_uInt16 nPrfx, - const OUString& rLName) - : SvXMLImportContext(rImport, nPrfx, rLName) {} - - const SmXMLImport& GetSmImport() const - { - return (const SmXMLImport&)GetImport(); - } - - SmXMLImport& GetSmImport() - { - return (SmXMLImport&)GetImport(); - } - - virtual void TCharacters(const OUString & /*rChars*/); - virtual void Characters(const OUString &rChars); - virtual SvXMLImportContext *CreateChildContext(sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/); -}; - -void SmXMLImportContext::TCharacters(const OUString & /*rChars*/) -{ -} - -void SmXMLImportContext::Characters(const OUString &rChars) -{ - /* - Whitespace occurring within the content of token elements is "trimmed" - from the ends (i.e. all whitespace at the beginning and end of the - content is removed), and "collapsed" internally (i.e. each sequence of - 1 or more whitespace characters is replaced with one blank character). - */ - //collapsing not done yet! - const OUString &rChars2 = rChars.trim(); - if (rChars2.getLength()) - TCharacters(rChars2/*.collapse()*/); -} - -SvXMLImportContext * SmXMLImportContext::CreateChildContext(sal_uInt16 /*nPrefix*/, - const OUString& /*rLocalName*/, - const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/) -{ - return 0; -} - -//////////////////////////////////////////////////////////// - -struct SmXMLContext_Helper -{ - sal_Int8 nIsBold; - sal_Int8 nIsItalic; - double nFontSize; - sal_Bool bFontNodeNeeded; - OUString sFontFamily; - OUString sColor; - - SmXMLImportContext rContext; - - SmXMLContext_Helper(SmXMLImportContext &rImport) : - nIsBold(-1), nIsItalic(-1), nFontSize(0.0), rContext(rImport) {} - - void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); - void ApplyAttrs(); -}; - -void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int8 nOldIsBold=nIsBold; - sal_Int8 nOldIsItalic=nIsItalic; - double nOldFontSize=nFontSize; - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - OUString sOldFontFamily = sFontFamily; - for (sal_Int16 i=0;igetNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = rContext.GetSmImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - rContext.GetSmImport().GetPresLayoutAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_FONTWEIGHT: - nIsBold = sValue.equals(GetXMLToken(XML_BOLD)); - break; - case XML_TOK_FONTSTYLE: - nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC)); - break; - case XML_TOK_FONTSIZE: - SvXMLUnitConverter::convertDouble(nFontSize,sValue); - rContext.GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_POINT); - if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) - { - if (-1 == sValue.indexOf('%')) - nFontSize=0.0; - else - { - rContext.GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_RELATIVE); - } - } - break; - case XML_TOK_FONTFAMILY: - sFontFamily = sValue; - break; - case XML_TOK_COLOR: - sColor = sValue; - break; - default: - break; - } - } - - if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) || - (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily) - || sColor.getLength()) - bFontNodeNeeded=sal_True; - else - bFontNodeNeeded=sal_False; -} - -void SmXMLContext_Helper::ApplyAttrs() -{ - SmNodeStack &rNodeStack = rContext.GetSmImport().GetNodeStack(); - - if (bFontNodeNeeded) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - - if (nIsBold != -1) - { - if (nIsBold) - aToken.eType = TBOLD; - else - aToken.eType = TNBOLD; - SmStructureNode *pFontNode = static_cast - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nIsItalic != -1) - { - if (nIsItalic) - aToken.eType = TITALIC; - else - aToken.eType = TNITALIC; - SmStructureNode *pFontNode = static_cast - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nFontSize != 0.0) - { - aToken.eType = TSIZE; - SmFontNode *pFontNode = new SmFontNode(aToken); - - if (MAP_RELATIVE == rContext.GetSmImport().GetMM100UnitConverter(). - getXMLMeasureUnit()) - { - if (nFontSize < 100.00) - pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), - FNTSIZ_DIVIDE); - else - pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), - FNTSIZ_MULTIPLY); - } - else - pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); - - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sFontFamily.getLength()) - { - if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED))) - aToken.eType = TFIXED; - else if (sFontFamily.equalsIgnoreAsciiCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("sans")))) - aToken.eType = TSANS; - else if (sFontFamily.equalsIgnoreAsciiCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("serif")))) - aToken.eType = TSERIF; - else //Just give up, we need to extend our font mechanism to be - //more general - return; - - aToken.aText = sFontFamily; - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sColor.getLength()) - { - //Again we can only handle a small set of colours in - //StarMath for now. - const SvXMLTokenMap& rTokenMap = - rContext.GetSmImport().GetColorTokenMap(); - aToken.eType = static_cast(rTokenMap.Get( - XML_NAMESPACE_MATH, sColor)); - if (aToken.eType != -1) - { - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - } - - } -} - -//////////////////////////////////////////////////////////// - -class SmXMLDocContext_Impl : public SmXMLImportContext -{ -public: - SmXMLDocContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrfx,rLName) {} - - virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); - - void EndElement(); -}; - -//////////////////////////////////////////////////////////// - -/*avert thy gaze from the proginator*/ -class SmXMLRowContext_Impl : public SmXMLDocContext_Impl -{ -protected: - ULONG nElementCount; - -public: - SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLDocContext_Impl(rImport,nPrefix,rLName) - { nElementCount = GetSmImport().GetNodeStack().Count(); } - - virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); - - SvXMLImportContext *StrictCreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); - - void EndElement(); -}; - -//////////////////////////////////////////////////////////// - -class SmXMLFracContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - -//////////////////////////////////////////////////////////// - -class SmXMLSqrtContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - -//////////////////////////////////////////////////////////// - -class SmXMLRootContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - -//////////////////////////////////////////////////////////// - -class SmXMLStyleContext_Impl : public SmXMLRowContext_Impl -{ -protected: - SmXMLContext_Helper aStyleHelper; - -public: - /*Right now the style tag is completely ignored*/ - SmXMLStyleContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName), - aStyleHelper(*this) {} - - void EndElement(); - void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); -}; - -void SmXMLStyleContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ -#if 1 - aStyleHelper.RetrieveAttrs(xAttrList); -#else - sal_Int8 nOldIsBold=nIsBold; - sal_Int8 nOldIsItalic=nIsItalic; - double nOldFontSize=nFontSize; - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - OUString sOldFontFamily = sFontFamily; - for (sal_Int16 i=0;igetNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetPresLayoutAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_FONTWEIGHT: - nIsBold = sValue.equals(GetXMLToken(XML_BOLD)); - break; - case XML_TOK_FONTSTYLE: - nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC)); - break; - case XML_TOK_FONTSIZE: - SvXMLUnitConverter::convertDouble(nFontSize,sValue); - GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_POINT); - if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) - if (-1 == sValue.indexOf('%')) - nFontSize=0.0; - else - { - GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_RELATIVE); - } - break; - case XML_TOK_FONTFAMILY: - sFontFamily = sValue; - break; - case XML_TOK_COLOR: - sColor = sValue; - break; - default: - break; - } - } - - if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) || - (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily) - || sColor.getLength()) - bFontNodeNeeded=sal_True; - else - bFontNodeNeeded=sal_False; -#endif -} - - -void SmXMLStyleContext_Impl::EndElement() -{ - /* - accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred " containing its - arguments - */ - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); -#if 1 - aStyleHelper.ApplyAttrs(); -#else - if (bFontNodeNeeded) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - - if (nIsBold != -1) - { - if (nIsBold) - aToken.eType = TBOLD; - else - aToken.eType = TNBOLD; - SmStructureNode *pFontNode = static_cast - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nIsItalic != -1) - { - if (nIsItalic) - aToken.eType = TITALIC; - else - aToken.eType = TNITALIC; - SmStructureNode *pFontNode = static_cast - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nFontSize != 0.0) - { - aToken.eType = TSIZE; - SmFontNode *pFontNode = new SmFontNode(aToken); - - if (MAP_RELATIVE == GetSmImport().GetMM100UnitConverter(). - getXMLMeasureUnit()) - { - if (nFontSize < 100.00) - pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), - FNTSIZ_DIVIDE); - else - pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), - FNTSIZ_MULTIPLY); - } - else - pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); - - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sFontFamily.getLength()) - { - if (sFontFamily.equalsIgnoreCase(GetXMLToken(XML_FIXED))) - aToken.eType = TFIXED; - else if (sFontFamily.equalsIgnoreCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("sans")))) - aToken.eType = TSANS; - else if (sFontFamily.equalsIgnoreCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("serif")))) - aToken.eType = TSERIF; - else //Just give up, we need to extend our font mechanism to be - //more general - return; - - aToken.aText = sFontFamily; - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sColor.getLength()) - { - //Again we can only handle a small set of colours in - //StarMath for now. - const SvXMLTokenMap& rTokenMap = - GetSmImport().GetColorTokenMap(); - aToken.eType = static_cast(rTokenMap.Get( - XML_NAMESPACE_MATH, sColor)); - if (aToken.eType != -1) - { - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - } - - } -#endif -} - -//////////////////////////////////////////////////////////// - -class SmXMLPaddedContext_Impl : public SmXMLRowContext_Impl -{ -public: - /*Right now the style tag is completely ignored*/ - SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - -void SmXMLPaddedContext_Impl::EndElement() -{ - /* - accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred " containing its - arguments - */ - if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); -} - -//////////////////////////////////////////////////////////// - -class SmXMLPhantomContext_Impl : public SmXMLRowContext_Impl -{ -public: - /*Right now the style tag is completely ignored*/ - SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - -void SmXMLPhantomContext_Impl::EndElement() -{ - /* - accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred " containing its - arguments - */ - if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); - - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TPHANTOM; - - SmStructureNode *pPhantom = static_cast - (new SmFontNode(aToken)); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - pPhantom->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pPhantom); -} - -//////////////////////////////////////////////////////////// - -class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl -{ -protected: - sal_Unicode cBegin; - sal_Unicode cEnd; - -public: - SmXMLFencedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName), - cBegin('('), cEnd(')') {} - - void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ); - void EndElement(); -}; - - -void SmXMLFencedContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for (sal_Int16 i=0;igetNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetFencedAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - //temp, starmath cannot handle multichar brackets (I think) - case XML_TOK_OPEN: - cBegin = sValue[0]; - break; - case XML_TOK_CLOSE: - cEnd = sValue[0]; - break; - default: - /*Go to superclass*/ - break; - } - } -} - - -void SmXMLFencedContext_Impl::EndElement() -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.aText = ','; - aToken.eType = TLEFT; - aToken.nLevel = 5; - - aToken.eType = TLPARENT; - aToken.cMathChar = cBegin; - SmStructureNode *pSNode = new SmBraceNode(aToken); - SmNode *pLeft = new SmMathSymbolNode(aToken); - - aToken.cMathChar = cEnd; - aToken.eType = TRPARENT; - SmNode *pRight = new SmMathSymbolNode(aToken); - - SmNodeArray aRelationArray; - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - aToken.cMathChar = '\0'; - aToken.aText = ','; - aToken.eType = TIDENT; - - ULONG i = rNodeStack.Count() - nElementCount; - if (rNodeStack.Count() - nElementCount > 1) - i += rNodeStack.Count() - 1 - nElementCount; - aRelationArray.resize(i); - while (rNodeStack.Count() > nElementCount) - { - aRelationArray[--i] = rNodeStack.Pop(); - if (i > 1 && rNodeStack.Count() > 1) - aRelationArray[--i] = new SmGlyphSpecialNode(aToken); - } - - SmToken aDummy; - SmStructureNode *pBody = new SmExpressionNode(aDummy); - pBody->SetSubNodes(aRelationArray); - - - pSNode->SetSubNodes(pLeft,pBody,pRight); - pSNode->SetScaleMode(SCALE_HEIGHT); - GetSmImport().GetNodeStack().Push(pSNode); -} - - -//////////////////////////////////////////////////////////// - -class SmXMLErrorContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - -void SmXMLErrorContext_Impl::EndElement() -{ - /*Right now the error tag is completely ignored, what - can I do with it in starmath, ?, maybe we need a - report window ourselves, do a test for validity of - the xml input, use merrors, and then generate - the markup inside the merror with a big red colour - of something. For now just throw them all away. - */ - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - while (rNodeStack.Count() > nElementCount) - { - SmNode *pNode = rNodeStack.Pop(); - delete pNode; - } -} - -//////////////////////////////////////////////////////////// - -class SmXMLNumberContext_Impl : public SmXMLImportContext -{ -protected: - SmToken aToken; - -public: - SmXMLNumberContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TNUMBER; - } - - virtual void TCharacters(const OUString &rChars); - - void EndElement(); -}; - -void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.aText = rChars; -} - -void SmXMLNumberContext_Impl::EndElement() -{ - GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_NUMBER)); -} - -//////////////////////////////////////////////////////////// - -class SmXMLAnnotationContext_Impl : public SmXMLImportContext -{ - sal_Bool bIsStarMath; - -public: - SmXMLAnnotationContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName), bIsStarMath(sal_False) {} - - virtual void Characters(const OUString &rChars); - - void StartElement(const uno::Reference & xAttrList ); -}; - -void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for (sal_Int16 i=0;igetNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetAnnotationAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_ENCODING: - bIsStarMath= sValue.equals( - OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0"))); - break; - default: - break; - } - } -} - -void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars) -{ - if (bIsStarMath) - GetSmImport().GetText().Append(String(rChars)); -} - -//////////////////////////////////////////////////////////// - -class SmXMLTextContext_Impl : public SmXMLImportContext -{ -protected: - SmToken aToken; - -public: - SmXMLTextContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TTEXT; - } - - virtual void TCharacters(const OUString &rChars); - - void EndElement(); -}; - -void SmXMLTextContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.aText = rChars; -} - -void SmXMLTextContext_Impl::EndElement() -{ - GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_TEXT)); -} - -//////////////////////////////////////////////////////////// - -class SmXMLStringContext_Impl : public SmXMLImportContext -{ -protected: - SmToken aToken; - -public: - SmXMLStringContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TTEXT; - } - - virtual void TCharacters(const OUString &rChars); - - void EndElement(); -}; - -void SmXMLStringContext_Impl::TCharacters(const OUString &rChars) -{ - /* - The content of elements should be rendered with visible "escaping" of - certain characters in the content, including at least "double quote" - itself, and preferably whitespace other than individual blanks. The intent - is for the viewer to see that the expression is a string literal, and to - see exactly which characters form its content. For example, double - quote is " might be rendered as "double quote is \"". - - Obviously this isn't fully done here. - */ - aToken.aText.Erase(); - aToken.aText += '\"'; - aToken.aText += String(rChars); - aToken.aText += '\"'; -} - -void SmXMLStringContext_Impl::EndElement() -{ - GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_FIXED)); -} - -//////////////////////////////////////////////////////////// - -class SmXMLIdentifierContext_Impl : public SmXMLImportContext -{ -protected: - SmXMLContext_Helper aStyleHelper; - SmToken aToken; - -public: - SmXMLIdentifierContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName),aStyleHelper(*this) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TIDENT; - } - - void TCharacters(const OUString &rChars); - void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) - { - aStyleHelper.RetrieveAttrs(xAttrList); - }; - void EndElement(); -}; - -void SmXMLIdentifierContext_Impl::EndElement() -{ - SmTextNode *pNode = 0; - //we will handle identifier italic/normal here instead of with a standalone - //font node - if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.Len() > 1)) - || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.Len() == 1))) - { - pNode = new SmTextNode(aToken,FNT_FUNCTION); - pNode->GetFont().SetItalic(ITALIC_NONE); - aStyleHelper.nIsItalic = -1; - } - else - pNode = new SmTextNode(aToken,FNT_VARIABLE); - if (aStyleHelper.bFontNodeNeeded && aStyleHelper.nIsItalic != -1) - { - if (aStyleHelper.nIsItalic) - pNode->GetFont().SetItalic(ITALIC_NORMAL); - else - pNode->GetFont().SetItalic(ITALIC_NONE); - } - - if ((-1!=aStyleHelper.nIsBold) || (0.0!=aStyleHelper.nFontSize) || - (aStyleHelper.sFontFamily.getLength()) || - aStyleHelper.sColor.getLength()) - aStyleHelper.bFontNodeNeeded=sal_True; - else - aStyleHelper.bFontNodeNeeded=sal_False; - if (aStyleHelper.bFontNodeNeeded) - aStyleHelper.ApplyAttrs(); - GetSmImport().GetNodeStack().Push(pNode); -} - -void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.aText = rChars; -} - -//////////////////////////////////////////////////////////// - -class SmXMLOperatorContext_Impl : public SmXMLImportContext -{ - sal_Bool bIsStretchy; - -protected: - SmToken aToken; - -public: - SmXMLOperatorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName), bIsStretchy(sal_False) - { - aToken.nGroup = 0; - aToken.eType = TSPECIAL; - aToken.nLevel = 5; - } - - void TCharacters(const OUString &rChars); - void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); - void EndElement(); -}; - -void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.cMathChar = rChars[0]; -} - -void SmXMLOperatorContext_Impl::EndElement() -{ - SmMathSymbolNode *pNode = new SmMathSymbolNode(aToken); - //For stretchy scaling the scaling must be retrieved from this node - //and applied to the expression itself so as to get the expression - //to scale the operator to the height of the expression itself - if (bIsStretchy) - pNode->SetScaleMode(SCALE_HEIGHT); - GetSmImport().GetNodeStack().Push(pNode); -} - - - -void SmXMLOperatorContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for (sal_Int16 i=0;igetNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetOperatorAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_STRETCHY: - bIsStretchy = sValue.equals( - GetXMLToken(XML_TRUE)); - break; - default: - break; - } - } -} - - -//////////////////////////////////////////////////////////// - -class SmXMLSpaceContext_Impl : public SmXMLImportContext -{ -public: - SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) {} - - void StartElement(const uno::Reference< xml::sax::XAttributeList >& xAttrList ); -}; - -void SmXMLSpaceContext_Impl::StartElement( - const uno::Reference & /*xAttrList*/ ) -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.eType = TBLANK; - aToken.nLevel = 5; - SmBlankNode *pBlank = new SmBlankNode(aToken); - pBlank->IncreaseBy(aToken); - GetSmImport().GetNodeStack().Push(pBlank); -} - -//////////////////////////////////////////////////////////// - -class SmXMLSubContext_Impl : public SmXMLRowContext_Impl -{ -protected: - void GenericEndElement(SmTokenType eType,SmSubSup aSubSup); - -public: - SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { - GenericEndElement(TRSUB,RSUB); - } -}; - - -void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup) -{ - /*The element requires exactly 2 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Sub has not two arguments"); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = eType; - SmSubSupNode *pNode = new SmSubSupNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.size(); i++) - aSubNodes[i] = NULL; - - aSubNodes[eSubSup+1] = rNodeStack.Pop(); - aSubNodes[0] = rNodeStack.Pop(); - pNode->SetSubNodes(aSubNodes); - rNodeStack.Push(pNode); -} - -//////////////////////////////////////////////////////////// - -class SmXMLSupContext_Impl : public SmXMLSubContext_Impl -{ -public: - SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { - GenericEndElement(TRSUP,RSUP); - } -}; - -//////////////////////////////////////////////////////////// - -class SmXMLSubSupContext_Impl : public SmXMLRowContext_Impl -{ -protected: - void GenericEndElement(SmTokenType eType, SmSubSup aSub,SmSubSup aSup); - -public: - SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { - GenericEndElement(TRSUB,RSUB,RSUP); - } -}; - -void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, - SmSubSup aSub,SmSubSup aSup) -{ - /*The element requires exactly 3 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3, - "SubSup has not three arguments"); - - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = eType; - SmSubSupNode *pNode = new SmSubSupNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.size(); i++) - aSubNodes[i] = NULL; - - aSubNodes[aSup+1] = rNodeStack.Pop(); - aSubNodes[aSub+1] = rNodeStack.Pop(); - aSubNodes[0] = rNodeStack.Pop(); - pNode->SetSubNodes(aSubNodes); - rNodeStack.Push(pNode); -} - -//////////////////////////////////////////////////////////// - -class SmXMLUnderContext_Impl : public SmXMLSubContext_Impl -{ -protected: - sal_Int16 nAttrCount; - -public: - SmXMLUnderContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} - - void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); - void EndElement(); - void HandleAccent(); -}; - -void SmXMLUnderContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; -} - -void SmXMLUnderContext_Impl::HandleAccent() -{ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Sub has not two arguments"); - - /*Just one special case for the underline thing*/ - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - SmNode *pTest = rNodeStack.Pop(); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TUNDERLINE; - - - SmNodeArray aSubNodes; - aSubNodes.resize(2); - - SmStructureNode *pNode = new SmAttributNode(aToken); - if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332) - { - aSubNodes[0] = new SmRectangleNode(aToken); - delete pTest; - } - else - aSubNodes[0] = pTest; - - aSubNodes[1] = rNodeStack.Pop(); - pNode->SetSubNodes(aSubNodes); - pNode->SetScaleMode(SCALE_WIDTH); - rNodeStack.Push(pNode); -} - - -void SmXMLUnderContext_Impl::EndElement() -{ - if (!nAttrCount) - GenericEndElement(TCSUB,CSUB); - else - HandleAccent(); -#if 0 - //UnderBrace trick - SmStructureNode *pNode = rNodeStack.Pop(); - if (pNode->GetSubNode(1)->GetToken().cMathChar == (0x0332|0xf000)) - if (pNode->GetSubNode(0)->GetToken().cMathChar == (0x0332|0xf000)) -#endif -} - -//////////////////////////////////////////////////////////// - -class SmXMLOverContext_Impl : public SmXMLSubContext_Impl -{ -protected: - sal_Int16 nAttrCount; - -public: - SmXMLOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLSubContext_Impl(rImport,nPrefix,rLName), nAttrCount(0) {} - - void EndElement(); - void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); - void HandleAccent(); -}; - - -void SmXMLOverContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; -} - - -void SmXMLOverContext_Impl::EndElement() -{ - if (!nAttrCount) - GenericEndElement(TCSUP,CSUP); - else - HandleAccent(); -} - - -void SmXMLOverContext_Impl::HandleAccent() -{ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Sub has not two arguments"); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TACUTE; - - SmAttributNode *pNode = new SmAttributNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - SmNodeArray aSubNodes; - aSubNodes.resize(2); - aSubNodes[0] = rNodeStack.Pop(); - aSubNodes[1] = rNodeStack.Pop(); - pNode->SetSubNodes(aSubNodes); - pNode->SetScaleMode(SCALE_WIDTH); - rNodeStack.Push(pNode); - -} - -//////////////////////////////////////////////////////////// - -class SmXMLUnderOverContext_Impl : public SmXMLSubSupContext_Impl -{ -public: - SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { - GenericEndElement(TCSUB,CSUB,CSUP); - } -}; - -//////////////////////////////////////////////////////////// - -class SmXMLMultiScriptsContext_Impl : public SmXMLSubSupContext_Impl -{ - sal_Bool bHasPrescripts; - -public: - SmXMLMultiScriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLSubSupContext_Impl(rImport,nPrefix,rLName), - bHasPrescripts(FALSE) {} - - void EndElement(); - void MiddleElement(); - SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); -}; - -//////////////////////////////////////////////////////////// - -class SmXMLNoneContext_Impl : public SmXMLImportContext -{ -public: - SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) {} - - void EndElement(); -}; - - -void SmXMLNoneContext_Impl::EndElement(void) -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.aText.Erase(); - aToken.nLevel = 5; - aToken.eType = TIDENT; - GetSmImport().GetNodeStack().Push( - new SmTextNode(aToken,FNT_VARIABLE)); -} - -//////////////////////////////////////////////////////////// - -class SmXMLPrescriptsContext_Impl : public SmXMLImportContext -{ -public: - SmXMLPrescriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) {} -}; - -//////////////////////////////////////////////////////////// - -class SmXMLTableRowContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLTableRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} - - SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); -}; - - -//////////////////////////////////////////////////////////// - -class SmXMLTableContext_Impl : public SmXMLTableRowContext_Impl -{ -public: - SmXMLTableContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLTableRowContext_Impl(rImport,nPrefix,rLName) - {} - - void EndElement(); - SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); -}; - - -//////////////////////////////////////////////////////////// - -class SmXMLTableCellContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLTableCellContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} -}; - -//////////////////////////////////////////////////////////// - -class SmXMLAlignGroupContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLAlignGroupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} - - /*Don't do anything with alignment for now*/ - void EndElement() - { - } -}; - -//////////////////////////////////////////////////////////// - -class SmXMLActionContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLActionContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} - - void EndElement(); -}; - -//////////////////////////////////////////////////////////// - -// NB: virtually inherit so we can multiply inherit properly -// in SmXMLFlatDocContext_Impl -class SmXMLOfficeContext_Impl : public virtual SvXMLImportContext -{ -public: - SmXMLOfficeContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx, - const OUString& rLName) - : SvXMLImportContext(rImport,nPrfx,rLName) {} - - virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); -}; - -SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList) -{ - SvXMLImportContext *pContext = 0; - if ( XML_NAMESPACE_OFFICE == nPrefix && - rLocalName == GetXMLToken(XML_META) ) - { - DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?"); - } - else if ( XML_NAMESPACE_OFFICE == nPrefix && - rLocalName == GetXMLToken(XML_SETTINGS) ) - { - pContext = new XMLDocumentSettingsContext( GetImport(), - XML_NAMESPACE_OFFICE, rLocalName, - xAttrList ); - } - else - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - - return pContext; -} - -//////////////////////////////////////////////////////////// - -// context for flat file xml format -class SmXMLFlatDocContext_Impl - : public SmXMLOfficeContext_Impl, public SvXMLMetaDocumentContext -{ -public: - SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, - USHORT i_nPrefix, const OUString & i_rLName, - const uno::Reference& i_xDocProps, - const uno::Reference& i_xDocBuilder); - - virtual ~SmXMLFlatDocContext_Impl(); - - virtual SvXMLImportContext *CreateChildContext(USHORT i_nPrefix, const OUString& i_rLocalName, const uno::Reference& i_xAttrList); -}; - -SmXMLFlatDocContext_Impl::SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, - USHORT i_nPrefix, const OUString & i_rLName, - const uno::Reference& i_xDocProps, - const uno::Reference& i_xDocBuilder) : - SvXMLImportContext(i_rImport, i_nPrefix, i_rLName), - SmXMLOfficeContext_Impl(i_rImport, i_nPrefix, i_rLName), - SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName, - i_xDocProps, i_xDocBuilder) -{ -} - -SmXMLFlatDocContext_Impl::~SmXMLFlatDocContext_Impl() -{ -} - -SvXMLImportContext *SmXMLFlatDocContext_Impl::CreateChildContext( - USHORT i_nPrefix, const OUString& i_rLocalName, - const uno::Reference& i_xAttrList) -{ - // behave like meta base class iff we encounter office:meta - if ( XML_NAMESPACE_OFFICE == i_nPrefix && - i_rLocalName == GetXMLToken(XML_META) ) - { - return SvXMLMetaDocumentContext::CreateChildContext( - i_nPrefix, i_rLocalName, i_xAttrList ); - } - else - { - return SmXMLOfficeContext_Impl::CreateChildContext( - i_nPrefix, i_rLocalName, i_xAttrList ); - } -} - -//////////////////////////////////////////////////////////// - -static __FAR_DATA SvXMLTokenMapEntry aPresLayoutElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_SEMANTICS, XML_TOK_SEMANTICS }, - { XML_NAMESPACE_MATH, XML_MATH, XML_TOK_MATH }, - { XML_NAMESPACE_MATH, XML_MSTYLE, XML_TOK_MSTYLE }, - { XML_NAMESPACE_MATH, XML_MERROR, XML_TOK_MERROR }, - { XML_NAMESPACE_MATH, XML_MPHANTOM, XML_TOK_MPHANTOM }, - { XML_NAMESPACE_MATH, XML_MROW, XML_TOK_MROW }, - { XML_NAMESPACE_MATH, XML_MFRAC, XML_TOK_MFRAC }, - { XML_NAMESPACE_MATH, XML_MSQRT, XML_TOK_MSQRT }, - { XML_NAMESPACE_MATH, XML_MROOT, XML_TOK_MROOT }, - { XML_NAMESPACE_MATH, XML_MSUB, XML_TOK_MSUB }, - { XML_NAMESPACE_MATH, XML_MSUP, XML_TOK_MSUP }, - { XML_NAMESPACE_MATH, XML_MSUBSUP, XML_TOK_MSUBSUP }, - { XML_NAMESPACE_MATH, XML_MUNDER, XML_TOK_MUNDER }, - { XML_NAMESPACE_MATH, XML_MOVER, XML_TOK_MOVER }, - { XML_NAMESPACE_MATH, XML_MUNDEROVER, XML_TOK_MUNDEROVER }, - { XML_NAMESPACE_MATH, XML_MMULTISCRIPTS, XML_TOK_MMULTISCRIPTS }, - { XML_NAMESPACE_MATH, XML_MTABLE, XML_TOK_MTABLE }, - { XML_NAMESPACE_MATH, XML_MACTION, XML_TOK_MACTION }, - { XML_NAMESPACE_MATH, XML_MFENCED, XML_TOK_MFENCED }, - { XML_NAMESPACE_MATH, XML_MPADDED, XML_TOK_MPADDED }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aPresLayoutAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_FONTWEIGHT, XML_TOK_FONTWEIGHT }, - { XML_NAMESPACE_MATH, XML_FONTSTYLE, XML_TOK_FONTSTYLE }, - { XML_NAMESPACE_MATH, XML_FONTSIZE, XML_TOK_FONTSIZE }, - { XML_NAMESPACE_MATH, XML_FONTFAMILY, XML_TOK_FONTFAMILY }, - { XML_NAMESPACE_MATH, XML_COLOR, XML_TOK_COLOR }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aFencedAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_OPEN, XML_TOK_OPEN }, - { XML_NAMESPACE_MATH, XML_CLOSE, XML_TOK_CLOSE }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aOperatorAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_STRETCHY, XML_TOK_STRETCHY }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aAnnotationAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_ENCODING, XML_TOK_ENCODING }, - XML_TOKEN_MAP_END -}; - - -static __FAR_DATA SvXMLTokenMapEntry aPresElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_ANNOTATION, XML_TOK_ANNOTATION }, - { XML_NAMESPACE_MATH, XML_MI, XML_TOK_MI }, - { XML_NAMESPACE_MATH, XML_MN, XML_TOK_MN }, - { XML_NAMESPACE_MATH, XML_MO, XML_TOK_MO }, - { XML_NAMESPACE_MATH, XML_MTEXT, XML_TOK_MTEXT }, - { XML_NAMESPACE_MATH, XML_MSPACE,XML_TOK_MSPACE }, - { XML_NAMESPACE_MATH, XML_MS, XML_TOK_MS }, - { XML_NAMESPACE_MATH, XML_MALIGNGROUP, XML_TOK_MALIGNGROUP }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aPresScriptEmptyElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_MPRESCRIPTS, XML_TOK_MPRESCRIPTS }, - { XML_NAMESPACE_MATH, XML_NONE, XML_TOK_NONE }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aPresTableElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_MTR, XML_TOK_MTR }, - { XML_NAMESPACE_MATH, XML_MTD, XML_TOK_MTD }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aColorTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_BLACK, TBLACK}, - { XML_NAMESPACE_MATH, XML_WHITE, TWHITE}, - { XML_NAMESPACE_MATH, XML_RED, TRED}, - { XML_NAMESPACE_MATH, XML_GREEN, TGREEN}, - { XML_NAMESPACE_MATH, XML_BLUE, TBLUE}, - { XML_NAMESPACE_MATH, XML_AQUA, TCYAN}, - { XML_NAMESPACE_MATH, XML_FUCHSIA, TMAGENTA}, - { XML_NAMESPACE_MATH, XML_YELLOW, TYELLOW}, - XML_TOKEN_MAP_END -}; - - -//////////////////////////////////////////////////////////// - -const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap() -{ - if (!pPresLayoutElemTokenMap) - pPresLayoutElemTokenMap = new SvXMLTokenMap(aPresLayoutElemTokenMap); - return *pPresLayoutElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap() -{ - if (!pPresLayoutAttrTokenMap) - pPresLayoutAttrTokenMap = new SvXMLTokenMap(aPresLayoutAttrTokenMap); - return *pPresLayoutAttrTokenMap; -} - - -const SvXMLTokenMap& SmXMLImport::GetFencedAttrTokenMap() -{ - if (!pFencedAttrTokenMap) - pFencedAttrTokenMap = new SvXMLTokenMap(aFencedAttrTokenMap); - return *pFencedAttrTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetOperatorAttrTokenMap() -{ - if (!pOperatorAttrTokenMap) - pOperatorAttrTokenMap = new SvXMLTokenMap(aOperatorAttrTokenMap); - return *pOperatorAttrTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetAnnotationAttrTokenMap() -{ - if (!pAnnotationAttrTokenMap) - pAnnotationAttrTokenMap = new SvXMLTokenMap(aAnnotationAttrTokenMap); - return *pAnnotationAttrTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresElemTokenMap() -{ - if (!pPresElemTokenMap) - pPresElemTokenMap = new SvXMLTokenMap(aPresElemTokenMap); - return *pPresElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresScriptEmptyElemTokenMap() -{ - if (!pPresScriptEmptyElemTokenMap) - pPresScriptEmptyElemTokenMap = new - SvXMLTokenMap(aPresScriptEmptyElemTokenMap); - return *pPresScriptEmptyElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresTableElemTokenMap() -{ - if (!pPresTableElemTokenMap) - pPresTableElemTokenMap = new SvXMLTokenMap(aPresTableElemTokenMap); - return *pPresTableElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetColorTokenMap() -{ - if (!pColorTokenMap) - pColorTokenMap = new SvXMLTokenMap(aColorTokenMap); - return *pColorTokenMap; -} - -//////////////////////////////////////////////////////////// - -SvXMLImportContext *SmXMLDocContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresLayoutElemTokenMap(); - - //UINT32 nTest = rTokenMap.Get(nPrefix, rLocalName); - - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - //Consider semantics a dummy except for any starmath annotations - case XML_TOK_SEMANTICS: - pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName, - xAttrList); - break; - /*General Layout Schemata*/ - case XML_TOK_MROW: - pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MFRAC: - pContext = GetSmImport().CreateFracContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSQRT: - pContext = GetSmImport().CreateSqrtContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MROOT: - pContext = GetSmImport().CreateRootContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSTYLE: - pContext = GetSmImport().CreateStyleContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MERROR: - pContext = GetSmImport().CreateErrorContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MPADDED: - pContext = GetSmImport().CreatePaddedContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MPHANTOM: - pContext = GetSmImport().CreatePhantomContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MFENCED: - pContext = GetSmImport().CreateFencedContext(nPrefix,rLocalName, - xAttrList); - break; - /*Script and Limit Schemata*/ - case XML_TOK_MSUB: - pContext = GetSmImport().CreateSubContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSUP: - pContext = GetSmImport().CreateSupContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSUBSUP: - pContext = GetSmImport().CreateSubSupContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MUNDER: - pContext = GetSmImport().CreateUnderContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MOVER: - pContext = GetSmImport().CreateOverContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MUNDEROVER: - pContext = GetSmImport().CreateUnderOverContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MMULTISCRIPTS: - pContext = GetSmImport().CreateMultiScriptsContext(nPrefix, - rLocalName, xAttrList); - break; - case XML_TOK_MTABLE: - pContext = GetSmImport().CreateTableContext(nPrefix, - rLocalName, xAttrList); - break; - case XML_TOK_MACTION: - pContext = GetSmImport().CreateActionContext(nPrefix, - rLocalName, xAttrList); - break; - default: - /*Basically theres an implicit mrow around certain bare - *elements, use a RowContext to see if this is one of - *those ones*/ - SmXMLRowContext_Impl aTempContext(GetSmImport(),nPrefix, - GetXMLToken(XML_MROW)); - - pContext = aTempContext.StrictCreateChildContext(nPrefix, - rLocalName, xAttrList); - break; - } - return pContext; -} - -void SmXMLDocContext_Impl::EndElement() -{ - SmNodeArray ContextArray; - ContextArray.resize(1); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - for (ULONG i=0;i< 1;i++) - ContextArray[i] = rNodeStack.Pop(); - - SmToken aDummy; - SmStructureNode *pSNode = new SmLineNode(aDummy); - pSNode->SetSubNodes(ContextArray); - rNodeStack.Push(pSNode); - - SmNodeArray LineArray; - ULONG n = rNodeStack.Count(); - LineArray.resize(n); - for (ULONG j = 0; j < n; j++) - LineArray[n - (j + 1)] = rNodeStack.Pop(); - SmStructureNode *pSNode2 = new SmTableNode(aDummy); - pSNode2->SetSubNodes(LineArray); - rNodeStack.Push(pSNode2); -} - -void SmXMLFracContext_Impl::EndElement() -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TOVER; - SmStructureNode *pSNode = new SmBinVerNode(aToken); - SmNode *pOper = new SmRectangleNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - DBG_ASSERT(rNodeStack.Count() - nElementCount == 2, - "Fraction (mfrac) tag is missing component"); - if (rNodeStack.Count() - nElementCount == 2) - { - SmNode *pSecond = rNodeStack.Pop(); - SmNode *pFirst = rNodeStack.Pop(); - pSNode->SetSubNodes(pFirst,pOper,pSecond); - rNodeStack.Push(pSNode); - } -} - -void SmXMLRootContext_Impl::EndElement() -{ - /*The element requires exactly 2 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Root tag is missing component"); - - SmToken aToken; - aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TNROOT; - SmStructureNode *pSNode = new SmRootNode(aToken); - SmNode *pOper = new SmRootSymbolNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - SmNode *pIndex = rNodeStack.Pop(); - SmNode *pBase = rNodeStack.Pop(); - pSNode->SetSubNodes(pIndex,pOper,pBase); - rNodeStack.Push(pSNode); -} - -void SmXMLSqrtContext_Impl::EndElement() -{ - /* - accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred " containing its - arguments - */ - if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); - - SmToken aToken; - aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TSQRT; - SmStructureNode *pSNode = new SmRootNode(aToken); - SmNode *pOper = new SmRootSymbolNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - pSNode->SetSubNodes(0,pOper,rNodeStack.Pop()); - rNodeStack.Push(pSNode); -} - -void SmXMLRowContext_Impl::EndElement() -{ - SmNodeArray aRelationArray; - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - ULONG nSize = rNodeStack.Count()-nElementCount; - - if (nSize > 0) - { - aRelationArray.resize(nSize); - for (ULONG j=rNodeStack.Count()-nElementCount;j > 0;j--) - aRelationArray[j-1] = rNodeStack.Pop(); - - - //If the first or last element is an operator with stretchyness - //set then we must create a brace node here from those elements, - //removing the stretchness from the operators and applying it to - //ourselves, and creating the appropiate dummy StarMath none bracket - //to balance the arrangement - if (((aRelationArray[0]->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray[0]->GetType() == NMATH)) - || ((aRelationArray[nSize-1]->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray[nSize-1]->GetType() == NMATH))) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - - int nLeft=0,nRight=0; - if ((aRelationArray[0]->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray[0]->GetType() == NMATH)) - { - aToken = aRelationArray[0]->GetToken(); - nLeft=1; - } - else - aToken.cMathChar = '\0'; - - aToken.eType = TLPARENT; - SmNode *pLeft = new SmMathSymbolNode(aToken); - - if ((aRelationArray[nSize-1]->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray[nSize-1]->GetType() == NMATH)) - { - aToken = aRelationArray[nSize-1]->GetToken(); - nRight=1; - } - else - aToken.cMathChar = '\0'; - - aToken.eType = TRPARENT; - SmNode *pRight = new SmMathSymbolNode(aToken); - - SmNodeArray aRelationArray2; - - //!! nSize-nLeft-nRight may be < 0 !! - int nRelArrSize = nSize-nLeft-nRight; - if (nRelArrSize > 0) - { - aRelationArray2.resize(nRelArrSize); - for (int i=0;i < nRelArrSize;i++) - aRelationArray2[i] = aRelationArray[i+nLeft]; - } - - SmToken aDummy; - SmStructureNode *pSNode = new SmBraceNode(aToken); - SmStructureNode *pBody = new SmExpressionNode(aDummy); - pBody->SetSubNodes(aRelationArray2); - - pSNode->SetSubNodes(pLeft,pBody,pRight); - pSNode->SetScaleMode(SCALE_HEIGHT); - rNodeStack.Push(pSNode); - return; - } - } - else //Multiple newlines result in empty row elements - { - aRelationArray.resize(1); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TNEWLINE; - aRelationArray[0] = new SmLineNode(aToken); - } - - SmToken aDummy; - SmStructureNode *pSNode = new SmExpressionNode(aDummy); - pSNode->SetSubNodes(aRelationArray); - rNodeStack.Push(pSNode); -} - - -SvXMLImportContext *SmXMLRowContext_Impl::StrictCreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - /*Note that these should accept malignmark subelements, but do not*/ - case XML_TOK_MN: - pContext = GetSmImport().CreateNumberContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MI: - pContext = GetSmImport().CreateIdentifierContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MO: - pContext = GetSmImport().CreateOperatorContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MTEXT: - pContext = GetSmImport().CreateTextContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSPACE: - pContext = GetSmImport().CreateSpaceContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MS: - pContext = GetSmImport().CreateStringContext(nPrefix,rLocalName, - xAttrList); - break; - - /*Note: The maligngroup should only be seen when the row - * (or decendants) are in a table*/ - case XML_TOK_MALIGNGROUP: - pContext = GetSmImport().CreateAlignGroupContext(nPrefix,rLocalName, - xAttrList); - break; - - case XML_TOK_ANNOTATION: - pContext = GetSmImport().CreateAnnotationContext(nPrefix,rLocalName, - xAttrList); - break; - - default: - break; - } - return pContext; -} - - -SvXMLImportContext *SmXMLRowContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference& xAttrList) -{ - SvXMLImportContext* pContext = StrictCreateChildContext(nPrefix, - rLocalName, xAttrList); - - if (!pContext) - { - //Hmm, unrecognized for this level, check to see if its - //an element that can have an implicit schema around it - pContext = SmXMLDocContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - } - return pContext; -} - - -SvXMLImportContext *SmXMLMultiScriptsContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport(). - GetPresScriptEmptyElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_MPRESCRIPTS: - MiddleElement(); - pContext = GetSmImport().CreatePrescriptsContext(nPrefix, - rLocalName, xAttrList); - break; - case XML_TOK_NONE: - pContext = GetSmImport().CreateNoneContext(nPrefix,rLocalName, - xAttrList); - break; - default: - pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - break; - } - return pContext; -} - -void SmXMLMultiScriptsContext_Impl::MiddleElement() -{ - bHasPrescripts=sal_True; - - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0, - "Sub has no arguments"); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.Count()-nElementCount > 1) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TRSUB; - ULONG nFinalCount = rNodeStack.Count()-nElementCount-1; - - SmNodeStack aReverseStack; - while (rNodeStack.Count()-nElementCount) - { - SmNode *pThing = rNodeStack.Pop(); - aReverseStack.Push(pThing); - } - - for (ULONG nCount=0;nCount < nFinalCount;nCount+=2) - { - SmSubSupNode *pNode = new SmSubSupNode(aToken); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.size(); i++) - aSubNodes[i] = NULL; - - /*On each loop the base and its sub sup pair becomes the - base for the next loop to which the next sub sup pair is - attached, i.e. wheels within wheels*/ - //if (nCount == 0) - aSubNodes[0] = aReverseStack.Pop(); - - SmNode *pScriptNode = aReverseStack.Pop(); - - if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || - (pScriptNode->GetToken().aText.Len()))) - aSubNodes[RSUB+1] = pScriptNode; - pScriptNode = aReverseStack.Pop(); - if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || - (pScriptNode->GetToken().aText.Len()))) - aSubNodes[RSUP+1] = pScriptNode; - - pNode->SetSubNodes(aSubNodes); - aReverseStack.Push(pNode); - } - rNodeStack.Push(aReverseStack.Pop()); - } -} - - -void SmXMLTableContext_Impl::EndElement() -{ - SmNodeArray aExpressionArray; - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - SmNodeStack aReverseStack; - aExpressionArray.resize(rNodeStack.Count()-nElementCount); - - ULONG nRows = rNodeStack.Count()-nElementCount; - USHORT nCols = 0; - - SmStructureNode *pArray; - for (ULONG i=rNodeStack.Count()-nElementCount;i > 0;i--) - { - pArray = (SmStructureNode *)rNodeStack.Pop(); - if (pArray->GetNumSubNodes() == 0) - { - //This is a little tricky, it is possible that there was - //be elements that were not inside a pair, in which - //case they will not be in a row, i.e. they will not have - //SubNodes, so we have to wait until here before we can - //resolve the situation. Implicitsurrounding tags are - //surprisingly difficult to get right within this - //architecture - - SmNodeArray aRelationArray; - aRelationArray.resize(1); - aRelationArray[0] = pArray; - SmToken aDummy; - pArray = new SmExpressionNode(aDummy); - pArray->SetSubNodes(aRelationArray); - } - - if (pArray->GetNumSubNodes() > nCols) - nCols = pArray->GetNumSubNodes(); - aReverseStack.Push(pArray); - } - aExpressionArray.resize(nCols*nRows); - ULONG j=0; - while (aReverseStack.Count()) - { - pArray = (SmStructureNode *)aReverseStack.Pop(); - for (USHORT i=0;iGetNumSubNodes();i++) - aExpressionArray[j++] = pArray->GetSubNode(i); - } - - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = TRGROUP; - aToken.nLevel = 0; - aToken.eType = TMATRIX; - SmMatrixNode *pSNode = new SmMatrixNode(aToken); - pSNode->SetSubNodes(aExpressionArray); - pSNode->SetRowCol(static_cast(nRows),nCols); - rNodeStack.Push(pSNode); -} - -SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport(). - GetPresTableElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_MTD: - pContext = GetSmImport().CreateTableCellContext(nPrefix, - rLocalName, xAttrList); - break; - default: - pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - break; - } - return pContext; -} - -SvXMLImportContext *SmXMLTableContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport(). - GetPresTableElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_MTR: - pContext = GetSmImport().CreateTableRowContext(nPrefix,rLocalName, - xAttrList); - break; - default: - pContext = SmXMLTableRowContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - break; - } - return pContext; -} - -void SmXMLMultiScriptsContext_Impl::EndElement() -{ - if (!bHasPrescripts) - MiddleElement(); - - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.Count()-nElementCount > 1) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TLSUB; - ULONG nFinalCount = rNodeStack.Count()-nElementCount-1; - - SmNodeStack aReverseStack; - while (rNodeStack.Count()-nElementCount) - aReverseStack.Push(rNodeStack.Pop()); - for (ULONG nCount=0;nCount < nFinalCount;nCount+=2) - { - SmSubSupNode *pNode = new SmSubSupNode(aToken); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.size(); i++) - aSubNodes[i] = NULL; - - /*On each loop the base and its sub sup pair becomes the - base for the next loop to which the next sub sup pair is - attached, i.e. wheels within wheels*/ - //if (nCount == 0) - aSubNodes[0] = aReverseStack.Pop(); - - SmNode *pScriptNode = aReverseStack.Pop(); - if (pScriptNode->GetToken().aText.Len()) - aSubNodes[LSUB+1] = pScriptNode; - pScriptNode = aReverseStack.Pop(); - if (pScriptNode->GetToken().aText.Len()) - aSubNodes[LSUP+1] = pScriptNode; - - pNode->SetSubNodes(aSubNodes); - aReverseStack.Push(pNode); - } - rNodeStack.Push(aReverseStack.Pop()); - } - -} -void SmXMLActionContext_Impl::EndElement() -{ - /*For now we will just assume that the - selected attribute is one, and then just display - that expression alone, i.e. remove all expect the - first pushed one*/ - - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - for (ULONG i=rNodeStack.Count()-nElementCount;i > 1;i--) - { - delete rNodeStack.Pop(); - } -} - -SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - if ( XML_NAMESPACE_OFFICE == nPrefix ) - { - if ( (IsXMLToken(rLocalName, XML_DOCUMENT) || - IsXMLToken(rLocalName, XML_DOCUMENT_META))) - { - uno::Reference xDocBuilder( - mxServiceFactory->createInstance( - ::rtl::OUString::createFromAscii( - "com.sun.star.xml.dom.SAXDocumentBuilder")), - uno::UNO_QUERY_THROW); - uno::Reference xDPS( - GetModel(), uno::UNO_QUERY_THROW); - return IsXMLToken(rLocalName, XML_DOCUMENT_META) - ? new SvXMLMetaDocumentContext(*this, - XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder) - // flat OpenDocument file format -- this has not been tested... - : new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); - } - else - { - return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName); - } - } - else - return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateRowContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLRowContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateTextContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLTextContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateAnnotationContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLAnnotationContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateStringContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLStringContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateNumberContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLNumberContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateIdentifierContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLIdentifierContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateOperatorContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLOperatorContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSpaceContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLSpaceContext_Impl(*this,nPrefix,rLocalName); -} - - -SvXMLImportContext *SmXMLImport::CreateFracContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLFracContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSqrtContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLSqrtContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateRootContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLRootContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateStyleContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLStyleContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreatePaddedContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLPaddedContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreatePhantomContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLPhantomContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateFencedContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLFencedContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateErrorContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLErrorContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSubContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLSubContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSubSupContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLSubSupContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSupContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLSupContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateUnderContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLUnderContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateOverContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLOverContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateUnderOverContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLUnderOverContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateMultiScriptsContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLMultiScriptsContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateTableContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLTableContext_Impl(*this,nPrefix,rLocalName); -} -SvXMLImportContext *SmXMLImport::CreateTableRowContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLTableRowContext_Impl(*this,nPrefix,rLocalName); -} -SvXMLImportContext *SmXMLImport::CreateTableCellContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLTableCellContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateNoneContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLNoneContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreatePrescriptsContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLPrescriptsContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateAlignGroupContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLAlignGroupContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateActionContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference & /*xAttrList*/) -{ - return new SmXMLActionContext_Impl(*this,nPrefix,rLocalName); -} - -SmXMLImport::~SmXMLImport() throw () -{ - delete pPresLayoutElemTokenMap; - delete pPresElemTokenMap; - delete pPresScriptEmptyElemTokenMap; - delete pPresTableElemTokenMap; - delete pPresLayoutAttrTokenMap; - delete pFencedAttrTokenMap; - delete pColorTokenMap; - delete pOperatorAttrTokenMap; - delete pAnnotationAttrTokenMap; -} - -void SmXMLImport::SetViewSettings(const Sequence& aViewProps) -{ - uno::Reference xModel = GetModel(); - if ( !xModel.is() ) - return; - - uno::Reference xTunnel; - xTunnel = uno::Reference (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - if ( !pModel ) - return; - - SmDocShell *pDocShell = - static_cast(pModel->GetObjectShell()); - if ( !pDocShell ) - return; - - Rectangle aRect( pDocShell->GetVisArea() ); - - sal_Int32 nCount = aViewProps.getLength(); - const PropertyValue *pValue = aViewProps.getConstArray(); - - long nTmp = 0; - //sal_Bool bShowDeletes = sal_False, bShowInserts = sal_False, bShowFooter = sal_False, bShowHeader = sal_False; - - for (sal_Int32 i = 0; i < nCount ; i++) - { - if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaTop" ) ) ) - { - pValue->Value >>= nTmp; - aRect.setY( nTmp ); - } - else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaLeft" ) ) ) - { - pValue->Value >>= nTmp; - aRect.setX( nTmp ); - } - else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaWidth" ) ) ) - { - pValue->Value >>= nTmp; - Size aSize( aRect.GetSize() ); - aSize.Width() = nTmp; - aRect.SetSize( aSize ); - } - else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaHeight" ) ) ) - { - pValue->Value >>= nTmp; - Size aSize( aRect.GetSize() ); - aSize.Height() = nTmp; - aRect.SetSize( aSize ); - } - pValue++; - } - - pDocShell->SetVisArea ( aRect ); -} - -void SmXMLImport::SetConfigurationSettings(const Sequence& aConfProps) -{ - uno::Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY ); - if ( xProps.is() ) - { - Reference < XPropertySetInfo > xInfo ( xProps->getPropertySetInfo() ); - if (xInfo.is() ) - { - sal_Int32 nCount = aConfProps.getLength(); - const PropertyValue* pValues = aConfProps.getConstArray(); - - const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) ); - const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) ); - const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) ); - while ( nCount-- ) - { - if (pValues->Name != sFormula && - pValues->Name != sBasicLibraries && - pValues->Name != sDialogLibraries) - { - try - { - if ( xInfo->hasPropertyByName( pValues->Name ) ) - xProps->setPropertyValue( pValues->Name, pValues->Value ); - } - catch( Exception& ) - { - DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" ); - } - } - - pValues++; - } - } - } -} - - -//////////////////////////////////////////////////////////// - +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x $ + * $Revision: 1.00 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_starmath.hxx" + +/*todo: Change characters and tcharacters to accumulate the characters together +into one string, xml parser hands them to us line by line rather than all in +one go*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "mathmlimport.hxx" +#include "mathtype.hxx" +#include +#include +#include +#include + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; +using namespace ::xmloff::token; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +#define IMPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter") + +#undef WANTEXCEPT + +//////////////////////////////////////////////////////////// + +ULONG SmXMLImportWrapper::Import(SfxMedium &rMedium) +{ + ULONG nError = ERRCODE_SFX_DOLOADFAILED; + + uno::Reference xServiceFactory( + utl::getProcessServiceFactory()); + DBG_ASSERT(xServiceFactory.is(), "XMLReader::Read: got no service manager"); + if ( !xServiceFactory.is() ) + return nError; + + //Make a model component from our SmModel + uno::Reference< lang::XComponent > xModelComp( xModel, uno::UNO_QUERY ); + DBG_ASSERT( xModelComp.is(), "XMLReader::Read: got no model" ); + + // try to get an XStatusIndicator from the Medium + uno::Reference xStatusIndicator; + + sal_Bool bEmbedded = sal_False; + uno::Reference xTunnel; + xTunnel = uno::Reference (xModel,uno::UNO_QUERY); + SmModel *pModel = reinterpret_cast + (xTunnel->getSomething(SmModel::getUnoTunnelId())); + + SmDocShell *pDocShell = pModel ? + static_cast(pModel->GetObjectShell()) : 0; + if (pDocShell) + { +// if (pDocShell->GetMedium()) + { + DBG_ASSERT( pDocShell->GetMedium() == &rMedium, + "different SfxMedium found" ); + + SfxItemSet* pSet = rMedium.GetItemSet(); + if (pSet) + { + const SfxUnoAnyItem* pItem = static_cast( + pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); + if (pItem) + pItem->GetValue() >>= xStatusIndicator; + } + } + + if ( SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() ) + bEmbedded = sal_True; + } + + comphelper::PropertyMapEntry aInfoMap[] = + { + { "PrivateData", sizeof("PrivateData")-1, 0, + &::getCppuType( (Reference *)0 ), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { "BaseURI", sizeof("BaseURI")-1, 0, + &::getCppuType( (OUString *)0 ), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { "StreamRelPath", sizeof("StreamRelPath")-1, 0, + &::getCppuType( (OUString *)0 ), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { "StreamName", sizeof("StreamName")-1, 0, + &::getCppuType( (OUString *)0 ), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { NULL, 0, 0, NULL, 0, 0 } + }; + uno::Reference< beans::XPropertySet > xInfoSet( + comphelper::GenericPropertySet_CreateInstance( + new comphelper::PropertySetInfo( aInfoMap ) ) ); + + // Set base URI + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") ); + xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL() ) ); + + sal_Int32 nSteps=3; + if ( !(rMedium.IsStorage())) + nSteps = 1; + + sal_Int32 nProgressRange(nSteps); + if (xStatusIndicator.is()) + { + xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)), + nProgressRange); + } + + nSteps=0; + if (xStatusIndicator.is()) + xStatusIndicator->setValue(nSteps++); + + if ( rMedium.IsStorage()) + { + // TODO/LATER: handle the case of embedded links gracefully + if ( bEmbedded ) // && !rMedium.GetStorage()->IsRoot() ) + { + OUString aName( RTL_CONSTASCII_USTRINGPARAM( "dummyObjName" ) ); + if ( rMedium.GetItemSet() ) + { + const SfxStringItem* pDocHierarchItem = static_cast( + rMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) ); + if ( pDocHierarchItem ) + aName = pDocHierarchItem->GetValue(); + } + + if ( aName.getLength() ) + { + sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")); + xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); + } + } + + sal_Bool bOASIS = ( SotStorage::GetVersion( rMedium.GetStorage() ) > SOFFICE_FILEFORMAT_60 ); + if (xStatusIndicator.is()) + xStatusIndicator->setValue(nSteps++); + + ULONG nWarn = ReadThroughComponent( + rMedium.GetStorage(), xModelComp, "meta.xml", "Meta.xml", + xServiceFactory, xInfoSet, + (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaImporter" + : "com.sun.star.comp.Math.XMLMetaImporter") ); + + if ( nWarn != ERRCODE_IO_BROKENPACKAGE ) + { + if (xStatusIndicator.is()) + xStatusIndicator->setValue(nSteps++); + + nWarn = ReadThroughComponent( + rMedium.GetStorage(), xModelComp, "settings.xml", 0, + xServiceFactory, xInfoSet, + (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsImporter" + : "com.sun.star.comp.Math.XMLSettingsImporter" ) ); + + if ( nWarn != ERRCODE_IO_BROKENPACKAGE ) + { + if (xStatusIndicator.is()) + xStatusIndicator->setValue(nSteps++); + + nError = ReadThroughComponent( + rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml", + xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter" ); + } + else + nError = ERRCODE_IO_BROKENPACKAGE; + } + else + nError = ERRCODE_IO_BROKENPACKAGE; + } + else + { + Reference xInputStream = + new utl::OInputStreamWrapper(rMedium.GetInStream()); + + if (xStatusIndicator.is()) + xStatusIndicator->setValue(nSteps++); + + nError = ReadThroughComponent( xInputStream, xModelComp, + xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter", FALSE ); + } + + if (xStatusIndicator.is()) + xStatusIndicator->end(); + return nError; +} + + +/// read a component (file + filter version) +ULONG SmXMLImportWrapper::ReadThroughComponent( + Reference xInputStream, + Reference xModelComponent, + Reference & rFactory, + Reference & rPropSet, + const sal_Char* pFilterName, + sal_Bool bEncrypted ) +{ + ULONG nError = ERRCODE_SFX_DOLOADFAILED; + DBG_ASSERT(xInputStream.is(), "input stream missing"); + DBG_ASSERT(xModelComponent.is(), "document missing"); + DBG_ASSERT(rFactory.is(), "factory missing"); + DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!"); + + // prepare ParserInputSrouce + xml::sax::InputSource aParserInput; + aParserInput.aInputStream = xInputStream; + + // get parser + Reference< xml::sax::XParser > xParser( + rFactory->createInstance( + OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), + UNO_QUERY ); + DBG_ASSERT( xParser.is(), "Can't create parser" ); + if ( !xParser.is() ) + return nError; + + Sequence aArgs( 1 ); + aArgs[0] <<= rPropSet; + + // get filter + Reference< xml::sax::XDocumentHandler > xFilter( + rFactory->createInstanceWithArguments( + OUString::createFromAscii(pFilterName), aArgs ), + UNO_QUERY ); + DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." ); + if ( !xFilter.is() ) + return nError; + + // connect parser and filter + xParser->setDocumentHandler( xFilter ); + + // connect model and filter + Reference < XImporter > xImporter( xFilter, UNO_QUERY ); + xImporter->setTargetDocument( xModelComponent ); + + // finally, parser the stream + try + { + xParser->parseStream( aParserInput ); + + uno::Reference xFilterTunnel; + xFilterTunnel = uno::Reference + ( xFilter, uno::UNO_QUERY ); + SmXMLImport *pFilter = reinterpret_cast< SmXMLImport * >( + sal::static_int_cast< sal_uIntPtr >( + xFilterTunnel->getSomething( SmXMLImport::getUnoTunnelId() ))); + if ( pFilter && pFilter->GetSuccess() ) + nError = 0; + } + catch( xml::sax::SAXParseException& r ) + { + // sax parser sends wrapped exceptions, + // try to find the original one + xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r); + sal_Bool bTryChild = sal_True; + + while( bTryChild ) + { + xml::sax::SAXException aTmp; + if ( aSaxEx.WrappedException >>= aTmp ) + aSaxEx = aTmp; + else + bTryChild = sal_False; + } + + packages::zip::ZipIOException aBrokenPackage; + if ( aSaxEx.WrappedException >>= aBrokenPackage ) + return ERRCODE_IO_BROKENPACKAGE; + + if ( bEncrypted ) + nError = ERRCODE_SFX_WRONGPASSWORD; + } + catch( xml::sax::SAXException& r ) + { + packages::zip::ZipIOException aBrokenPackage; + if ( r.WrappedException >>= aBrokenPackage ) + return ERRCODE_IO_BROKENPACKAGE; + + if ( bEncrypted ) + nError = ERRCODE_SFX_WRONGPASSWORD; + } + catch( packages::zip::ZipIOException& ) + { + nError = ERRCODE_IO_BROKENPACKAGE; + } + catch( io::IOException& ) + { + } + + return nError; +} + + +ULONG SmXMLImportWrapper::ReadThroughComponent( + const uno::Reference< embed::XStorage >& xStorage, + Reference xModelComponent, + const sal_Char* pStreamName, + const sal_Char* pCompatibilityStreamName, + Reference & rFactory, + Reference & rPropSet, + const sal_Char* pFilterName ) +{ + DBG_ASSERT(xStorage.is(), "Need storage!"); + DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!"); + + // open stream (and set parser input) + OUString sStreamName = OUString::createFromAscii(pStreamName); + uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY ); + if ( !xAccess->hasByName(sStreamName) || !xStorage->isStreamElement(sStreamName) ) + { + // stream name not found! Then try the compatibility name. + // do we even have an alternative name? + if ( pCompatibilityStreamName ) + sStreamName = OUString::createFromAscii(pCompatibilityStreamName); + } + + // get input stream + try + { + uno::Reference < io::XStream > xEventsStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ ); + + // determine if stream is encrypted or not + uno::Reference < beans::XPropertySet > xProps( xEventsStream, uno::UNO_QUERY ); + Any aAny = xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ) ); + sal_Bool bEncrypted = sal_False; + if ( aAny.getValueType() == ::getBooleanCppuType() ) + aAny >>= bEncrypted; + + // set Base URL + if ( rPropSet.is() ) + { + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") ); + rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); + } + + + Reference < io::XInputStream > xStream = xEventsStream->getInputStream(); + return ReadThroughComponent( xStream, xModelComponent, rFactory, rPropSet, pFilterName, bEncrypted ); + } + catch ( packages::WrongPasswordException& ) + { + return ERRCODE_SFX_WRONGPASSWORD; + } + catch( packages::zip::ZipIOException& ) + { + return ERRCODE_IO_BROKENPACKAGE; + } + catch ( uno::Exception& ) + { + } + + return ERRCODE_SFX_DOLOADFAILED; +} + +//////////////////////////////////////////////////////////// + +SmXMLImport::SmXMLImport( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + sal_uInt16 nImportFlags) +: SvXMLImport( xServiceFactory, nImportFlags ), + pPresLayoutElemTokenMap(0), + pPresLayoutAttrTokenMap(0), + pFencedAttrTokenMap(0), + pOperatorAttrTokenMap(0), + pAnnotationAttrTokenMap(0), + pPresElemTokenMap(0), + pPresScriptEmptyElemTokenMap(0), + pPresTableElemTokenMap(0), + pColorTokenMap(0), + bSuccess(sal_False) +{ +} + +const uno::Sequence< sal_Int8 > & SmXMLImport::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if ( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if ( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +OUString SAL_CALL SmXMLImport_getImplementationName() throw() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLImporter" ) ); +} + +uno::Sequence< OUString > SAL_CALL SmXMLImport_getSupportedServiceNames() + throw() +{ + const OUString aServiceName( IMPORT_SVC_NAME ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL SmXMLImport_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & rSMgr) + throw( uno::Exception ) +{ + // #110680# + // return (cppu::OWeakObject*)new SmXMLImport(IMPORT_ALL); + return (cppu::OWeakObject*)new SmXMLImport(rSMgr, IMPORT_ALL); +} + +//////////////////////////////////////////////////////////// + +OUString SAL_CALL SmXMLImportMeta_getImplementationName() throw() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisMetaImporter" ) ); +} + +uno::Sequence< OUString > SAL_CALL SmXMLImportMeta_getSupportedServiceNames() +throw() +{ + const OUString aServiceName( IMPORT_SVC_NAME ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL SmXMLImportMeta_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & rSMgr) +throw( uno::Exception ) +{ + // #110680# + // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_META ); + return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_META ); +} + +//////////////////////////////////////////////////////////// + +OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisSettingsImporter" ) ); +} + +uno::Sequence< OUString > SAL_CALL SmXMLImportSettings_getSupportedServiceNames() + throw() +{ + const OUString aServiceName( IMPORT_SVC_NAME ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & rSMgr) + throw( uno::Exception ) +{ + // #110680# + // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_SETTINGS ); + return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_SETTINGS ); +} + +//////////////////////////////////////////////////////////// + +// XServiceInfo +// override empty method from parent class +rtl::OUString SAL_CALL SmXMLImport::getImplementationName() + throw(uno::RuntimeException) +{ + OUString aTxt; + switch( getImportFlags() ) + { + case IMPORT_META: + aTxt = SmXMLImportMeta_getImplementationName(); + break; + case IMPORT_SETTINGS: + aTxt = SmXMLImportSettings_getImplementationName(); + break; + case IMPORT_ALL: + default: + aTxt = SmXMLImport_getImplementationName(); + break; + } + return aTxt; +} + + +sal_Int64 SAL_CALL SmXMLImport::getSomething( + const uno::Sequence< sal_Int8 >&rId ) +throw(uno::RuntimeException) +{ + if ( rId.getLength() == 16 && + 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); + + return SvXMLImport::getSomething( rId ); +} + +void SmXMLImport::endDocument(void) + throw(xml::sax::SAXException, uno::RuntimeException) +{ + //Set the resulted tree into the SmDocShell where it belongs + SmNode *pTree; + if (NULL != (pTree = GetTree())) + { + uno::Reference xModel = GetModel(); + uno::Reference xTunnel; + xTunnel = uno::Reference (xModel,uno::UNO_QUERY); + SmModel *pModel = reinterpret_cast + (xTunnel->getSomething(SmModel::getUnoTunnelId())); + + if (pModel) + { + SmDocShell *pDocShell = + static_cast(pModel->GetObjectShell()); + pDocShell->SetFormulaTree(pTree); + if (0 == aText.Len()) //If we picked up no annotation text + { + //Make up some editable text + aText = pDocShell->GetText(); + pTree->CreateTextFromNode(aText); + aText.EraseTrailingChars(); + if ((aText.GetChar(0) == '{') && + (aText.GetChar(aText.Len()-1) == '}')) + { + aText.Erase(0,1); + aText.Erase(aText.Len()-1,1); + } + } + pDocShell->SetText( String() ); + + // Convert symbol names + SmParser &rParser = pDocShell->GetParser(); + BOOL bVal = rParser.IsImportSymbolNames(); + rParser.SetImportSymbolNames( TRUE ); + SmNode *pTmpTree = rParser.Parse( aText ); + aText = rParser.GetText(); + delete pTmpTree; + rParser.SetImportSymbolNames( bVal ); + + pDocShell->SetText( aText ); + } + DBG_ASSERT(pModel,"So there *was* a uno problem after all"); + + bSuccess = sal_True; + } + + SvXMLImport::endDocument(); +} + +//////////////////////////////////////////////////////////// + +class SmXMLImportContext: public SvXMLImportContext +{ +public: + SmXMLImportContext( SmXMLImport &rImport, sal_uInt16 nPrfx, + const OUString& rLName) + : SvXMLImportContext(rImport, nPrfx, rLName) {} + + const SmXMLImport& GetSmImport() const + { + return (const SmXMLImport&)GetImport(); + } + + SmXMLImport& GetSmImport() + { + return (SmXMLImport&)GetImport(); + } + + virtual void TCharacters(const OUString & /*rChars*/); + virtual void Characters(const OUString &rChars); + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/); +}; + +void SmXMLImportContext::TCharacters(const OUString & /*rChars*/) +{ +} + +void SmXMLImportContext::Characters(const OUString &rChars) +{ + /* + Whitespace occurring within the content of token elements is "trimmed" + from the ends (i.e. all whitespace at the beginning and end of the + content is removed), and "collapsed" internally (i.e. each sequence of + 1 or more whitespace characters is replaced with one blank character). + */ + //collapsing not done yet! + const OUString &rChars2 = rChars.trim(); + if (rChars2.getLength()) + TCharacters(rChars2/*.collapse()*/); +} + +SvXMLImportContext * SmXMLImportContext::CreateChildContext(sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/) +{ + return 0; +} + +//////////////////////////////////////////////////////////// + +struct SmXMLContext_Helper +{ + sal_Int8 nIsBold; + sal_Int8 nIsItalic; + double nFontSize; + sal_Bool bFontNodeNeeded; + OUString sFontFamily; + OUString sColor; + + SmXMLImportContext rContext; + + SmXMLContext_Helper(SmXMLImportContext &rImport) : + nIsBold(-1), nIsItalic(-1), nFontSize(0.0), rContext(rImport) {} + + void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); + void ApplyAttrs(); +}; + +void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ + sal_Int8 nOldIsBold=nIsBold; + sal_Int8 nOldIsItalic=nIsItalic; + double nOldFontSize=nFontSize; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + OUString sOldFontFamily = sFontFamily; + for (sal_Int16 i=0;igetNameByIndex(i); + OUString aLocalName; + sal_uInt16 nPrefix = rContext.GetSmImport().GetNamespaceMap(). + GetKeyByAttrName(sAttrName,&aLocalName); + OUString sValue = xAttrList->getValueByIndex(i); + const SvXMLTokenMap &rAttrTokenMap = + rContext.GetSmImport().GetPresLayoutAttrTokenMap(); + switch(rAttrTokenMap.Get(nPrefix,aLocalName)) + { + case XML_TOK_FONTWEIGHT: + nIsBold = sValue.equals(GetXMLToken(XML_BOLD)); + break; + case XML_TOK_FONTSTYLE: + nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC)); + break; + case XML_TOK_FONTSIZE: + SvXMLUnitConverter::convertDouble(nFontSize,sValue); + rContext.GetSmImport().GetMM100UnitConverter(). + setXMLMeasureUnit(MAP_POINT); + if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) + { + if (-1 == sValue.indexOf('%')) + nFontSize=0.0; + else + { + rContext.GetSmImport().GetMM100UnitConverter(). + setXMLMeasureUnit(MAP_RELATIVE); + } + } + break; + case XML_TOK_FONTFAMILY: + sFontFamily = sValue; + break; + case XML_TOK_COLOR: + sColor = sValue; + break; + default: + break; + } + } + + if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) || + (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily) + || sColor.getLength()) + bFontNodeNeeded=sal_True; + else + bFontNodeNeeded=sal_False; +} + +void SmXMLContext_Helper::ApplyAttrs() +{ + SmNodeStack &rNodeStack = rContext.GetSmImport().GetNodeStack(); + + if (bFontNodeNeeded) + { + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + + if (nIsBold != -1) + { + if (nIsBold) + aToken.eType = TBOLD; + else + aToken.eType = TNBOLD; + SmStructureNode *pFontNode = static_cast + (new SmFontNode(aToken)); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (nIsItalic != -1) + { + if (nIsItalic) + aToken.eType = TITALIC; + else + aToken.eType = TNITALIC; + SmStructureNode *pFontNode = static_cast + (new SmFontNode(aToken)); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (nFontSize != 0.0) + { + aToken.eType = TSIZE; + SmFontNode *pFontNode = new SmFontNode(aToken); + + if (MAP_RELATIVE == rContext.GetSmImport().GetMM100UnitConverter(). + getXMLMeasureUnit()) + { + if (nFontSize < 100.00) + pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), + FNTSIZ_DIVIDE); + else + pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), + FNTSIZ_MULTIPLY); + } + else + pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); + + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (sFontFamily.getLength()) + { + if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED))) + aToken.eType = TFIXED; + else if (sFontFamily.equalsIgnoreAsciiCase(OUString( + RTL_CONSTASCII_USTRINGPARAM("sans")))) + aToken.eType = TSANS; + else if (sFontFamily.equalsIgnoreAsciiCase(OUString( + RTL_CONSTASCII_USTRINGPARAM("serif")))) + aToken.eType = TSERIF; + else //Just give up, we need to extend our font mechanism to be + //more general + return; + + aToken.aText = sFontFamily; + SmFontNode *pFontNode = new SmFontNode(aToken); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (sColor.getLength()) + { + //Again we can only handle a small set of colours in + //StarMath for now. + const SvXMLTokenMap& rTokenMap = + rContext.GetSmImport().GetColorTokenMap(); + aToken.eType = static_cast(rTokenMap.Get( + XML_NAMESPACE_MATH, sColor)); + if (aToken.eType != -1) + { + SmFontNode *pFontNode = new SmFontNode(aToken); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + } + + } +} + +//////////////////////////////////////////////////////////// + +class SmXMLDocContext_Impl : public SmXMLImportContext +{ +public: + SmXMLDocContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrfx,rLName) {} + + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); + + void EndElement(); +}; + +//////////////////////////////////////////////////////////// + +/*avert thy gaze from the proginator*/ +class SmXMLRowContext_Impl : public SmXMLDocContext_Impl +{ +protected: + ULONG nElementCount; + +public: + SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLDocContext_Impl(rImport,nPrefix,rLName) + { nElementCount = GetSmImport().GetNodeStack().Count(); } + + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); + + SvXMLImportContext *StrictCreateChildContext(sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > &xAttrList); + + void EndElement(); +}; + +//////////////////////////////////////////////////////////// + +class SmXMLFracContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + +//////////////////////////////////////////////////////////// + +class SmXMLSqrtContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + +//////////////////////////////////////////////////////////// + +class SmXMLRootContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + +//////////////////////////////////////////////////////////// + +class SmXMLStyleContext_Impl : public SmXMLRowContext_Impl +{ +protected: + SmXMLContext_Helper aStyleHelper; + +public: + /*Right now the style tag is completely ignored*/ + SmXMLStyleContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName), + aStyleHelper(*this) {} + + void EndElement(); + void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); +}; + +void SmXMLStyleContext_Impl::StartElement(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ +#if 1 + aStyleHelper.RetrieveAttrs(xAttrList); +#else + sal_Int8 nOldIsBold=nIsBold; + sal_Int8 nOldIsItalic=nIsItalic; + double nOldFontSize=nFontSize; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + OUString sOldFontFamily = sFontFamily; + for (sal_Int16 i=0;igetNameByIndex(i); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). + GetKeyByAttrName(sAttrName,&aLocalName); + OUString sValue = xAttrList->getValueByIndex(i); + const SvXMLTokenMap &rAttrTokenMap = + GetSmImport().GetPresLayoutAttrTokenMap(); + switch(rAttrTokenMap.Get(nPrefix,aLocalName)) + { + case XML_TOK_FONTWEIGHT: + nIsBold = sValue.equals(GetXMLToken(XML_BOLD)); + break; + case XML_TOK_FONTSTYLE: + nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC)); + break; + case XML_TOK_FONTSIZE: + SvXMLUnitConverter::convertDouble(nFontSize,sValue); + GetSmImport().GetMM100UnitConverter(). + setXMLMeasureUnit(MAP_POINT); + if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) + if (-1 == sValue.indexOf('%')) + nFontSize=0.0; + else + { + GetSmImport().GetMM100UnitConverter(). + setXMLMeasureUnit(MAP_RELATIVE); + } + break; + case XML_TOK_FONTFAMILY: + sFontFamily = sValue; + break; + case XML_TOK_COLOR: + sColor = sValue; + break; + default: + break; + } + } + + if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) || + (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily) + || sColor.getLength()) + bFontNodeNeeded=sal_True; + else + bFontNodeNeeded=sal_False; +#endif +} + + +void SmXMLStyleContext_Impl::EndElement() +{ + /* + accepts any number of arguments; if this number is not 1, its + contents are treated as a single "inferred " containing its + arguments + */ + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + if (rNodeStack.Count() - nElementCount > 1) + SmXMLRowContext_Impl::EndElement(); +#if 1 + aStyleHelper.ApplyAttrs(); +#else + if (bFontNodeNeeded) + { + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + + if (nIsBold != -1) + { + if (nIsBold) + aToken.eType = TBOLD; + else + aToken.eType = TNBOLD; + SmStructureNode *pFontNode = static_cast + (new SmFontNode(aToken)); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (nIsItalic != -1) + { + if (nIsItalic) + aToken.eType = TITALIC; + else + aToken.eType = TNITALIC; + SmStructureNode *pFontNode = static_cast + (new SmFontNode(aToken)); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (nFontSize != 0.0) + { + aToken.eType = TSIZE; + SmFontNode *pFontNode = new SmFontNode(aToken); + + if (MAP_RELATIVE == GetSmImport().GetMM100UnitConverter(). + getXMLMeasureUnit()) + { + if (nFontSize < 100.00) + pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), + FNTSIZ_DIVIDE); + else + pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), + FNTSIZ_MULTIPLY); + } + else + pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); + + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (sFontFamily.getLength()) + { + if (sFontFamily.equalsIgnoreCase(GetXMLToken(XML_FIXED))) + aToken.eType = TFIXED; + else if (sFontFamily.equalsIgnoreCase(OUString( + RTL_CONSTASCII_USTRINGPARAM("sans")))) + aToken.eType = TSANS; + else if (sFontFamily.equalsIgnoreCase(OUString( + RTL_CONSTASCII_USTRINGPARAM("serif")))) + aToken.eType = TSERIF; + else //Just give up, we need to extend our font mechanism to be + //more general + return; + + aToken.aText = sFontFamily; + SmFontNode *pFontNode = new SmFontNode(aToken); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + if (sColor.getLength()) + { + //Again we can only handle a small set of colours in + //StarMath for now. + const SvXMLTokenMap& rTokenMap = + GetSmImport().GetColorTokenMap(); + aToken.eType = static_cast(rTokenMap.Get( + XML_NAMESPACE_MATH, sColor)); + if (aToken.eType != -1) + { + SmFontNode *pFontNode = new SmFontNode(aToken); + pFontNode->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pFontNode); + } + } + + } +#endif +} + +//////////////////////////////////////////////////////////// + +class SmXMLPaddedContext_Impl : public SmXMLRowContext_Impl +{ +public: + /*Right now the style tag is completely ignored*/ + SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + +void SmXMLPaddedContext_Impl::EndElement() +{ + /* + accepts any number of arguments; if this number is not 1, its + contents are treated as a single "inferred " containing its + arguments + */ + if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) + SmXMLRowContext_Impl::EndElement(); +} + +//////////////////////////////////////////////////////////// + +class SmXMLPhantomContext_Impl : public SmXMLRowContext_Impl +{ +public: + /*Right now the style tag is completely ignored*/ + SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + +void SmXMLPhantomContext_Impl::EndElement() +{ + /* + accepts any number of arguments; if this number is not 1, its + contents are treated as a single "inferred " containing its + arguments + */ + if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) + SmXMLRowContext_Impl::EndElement(); + + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + aToken.eType = TPHANTOM; + + SmStructureNode *pPhantom = static_cast + (new SmFontNode(aToken)); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + pPhantom->SetSubNodes(0,rNodeStack.Pop()); + rNodeStack.Push(pPhantom); +} + +//////////////////////////////////////////////////////////// + +class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl +{ +protected: + sal_Unicode cBegin; + sal_Unicode cEnd; + +public: + SmXMLFencedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName), + cBegin('('), cEnd(')') {} + + void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ); + void EndElement(); +}; + + +void SmXMLFencedContext_Impl::StartElement(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for (sal_Int16 i=0;igetNameByIndex(i); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). + GetKeyByAttrName(sAttrName,&aLocalName); + OUString sValue = xAttrList->getValueByIndex(i); + const SvXMLTokenMap &rAttrTokenMap = + GetSmImport().GetFencedAttrTokenMap(); + switch(rAttrTokenMap.Get(nPrefix,aLocalName)) + { + //temp, starmath cannot handle multichar brackets (I think) + case XML_TOK_OPEN: + cBegin = sValue[0]; + break; + case XML_TOK_CLOSE: + cEnd = sValue[0]; + break; + default: + /*Go to superclass*/ + break; + } + } +} + + +void SmXMLFencedContext_Impl::EndElement() +{ + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.aText = ','; + aToken.eType = TLEFT; + aToken.nLevel = 5; + + aToken.eType = TLPARENT; + aToken.cMathChar = cBegin; + SmStructureNode *pSNode = new SmBraceNode(aToken); + SmNode *pLeft = new SmMathSymbolNode(aToken); + + aToken.cMathChar = cEnd; + aToken.eType = TRPARENT; + SmNode *pRight = new SmMathSymbolNode(aToken); + + SmNodeArray aRelationArray; + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + + aToken.cMathChar = '\0'; + aToken.aText = ','; + aToken.eType = TIDENT; + + ULONG i = rNodeStack.Count() - nElementCount; + if (rNodeStack.Count() - nElementCount > 1) + i += rNodeStack.Count() - 1 - nElementCount; + aRelationArray.resize(i); + while (rNodeStack.Count() > nElementCount) + { + aRelationArray[--i] = rNodeStack.Pop(); + if (i > 1 && rNodeStack.Count() > 1) + aRelationArray[--i] = new SmGlyphSpecialNode(aToken); + } + + SmToken aDummy; + SmStructureNode *pBody = new SmExpressionNode(aDummy); + pBody->SetSubNodes(aRelationArray); + + + pSNode->SetSubNodes(pLeft,pBody,pRight); + pSNode->SetScaleMode(SCALE_HEIGHT); + GetSmImport().GetNodeStack().Push(pSNode); +} + + +//////////////////////////////////////////////////////////// + +class SmXMLErrorContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + +void SmXMLErrorContext_Impl::EndElement() +{ + /*Right now the error tag is completely ignored, what + can I do with it in starmath, ?, maybe we need a + report window ourselves, do a test for validity of + the xml input, use merrors, and then generate + the markup inside the merror with a big red colour + of something. For now just throw them all away. + */ + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + while (rNodeStack.Count() > nElementCount) + { + SmNode *pNode = rNodeStack.Pop(); + delete pNode; + } +} + +//////////////////////////////////////////////////////////// + +class SmXMLNumberContext_Impl : public SmXMLImportContext +{ +protected: + SmToken aToken; + +public: + SmXMLNumberContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName) + { + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + aToken.eType = TNUMBER; + } + + virtual void TCharacters(const OUString &rChars); + + void EndElement(); +}; + +void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars) +{ + aToken.aText = rChars; +} + +void SmXMLNumberContext_Impl::EndElement() +{ + GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_NUMBER)); +} + +//////////////////////////////////////////////////////////// + +class SmXMLAnnotationContext_Impl : public SmXMLImportContext +{ + sal_Bool bIsStarMath; + +public: + SmXMLAnnotationContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName), bIsStarMath(sal_False) {} + + virtual void Characters(const OUString &rChars); + + void StartElement(const uno::Reference & xAttrList ); +}; + +void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for (sal_Int16 i=0;igetNameByIndex(i); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). + GetKeyByAttrName(sAttrName,&aLocalName); + + OUString sValue = xAttrList->getValueByIndex(i); + const SvXMLTokenMap &rAttrTokenMap = + GetSmImport().GetAnnotationAttrTokenMap(); + switch(rAttrTokenMap.Get(nPrefix,aLocalName)) + { + case XML_TOK_ENCODING: + bIsStarMath= sValue.equals( + OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0"))); + break; + default: + break; + } + } +} + +void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars) +{ + if (bIsStarMath) + GetSmImport().GetText().Append(String(rChars)); +} + +//////////////////////////////////////////////////////////// + +class SmXMLTextContext_Impl : public SmXMLImportContext +{ +protected: + SmToken aToken; + +public: + SmXMLTextContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName) + { + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + aToken.eType = TTEXT; + } + + virtual void TCharacters(const OUString &rChars); + + void EndElement(); +}; + +void SmXMLTextContext_Impl::TCharacters(const OUString &rChars) +{ + aToken.aText = rChars; +} + +void SmXMLTextContext_Impl::EndElement() +{ + GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_TEXT)); +} + +//////////////////////////////////////////////////////////// + +class SmXMLStringContext_Impl : public SmXMLImportContext +{ +protected: + SmToken aToken; + +public: + SmXMLStringContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName) + { + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + aToken.eType = TTEXT; + } + + virtual void TCharacters(const OUString &rChars); + + void EndElement(); +}; + +void SmXMLStringContext_Impl::TCharacters(const OUString &rChars) +{ + /* + The content of elements should be rendered with visible "escaping" of + certain characters in the content, including at least "double quote" + itself, and preferably whitespace other than individual blanks. The intent + is for the viewer to see that the expression is a string literal, and to + see exactly which characters form its content. For example, double + quote is " might be rendered as "double quote is \"". + + Obviously this isn't fully done here. + */ + aToken.aText.Erase(); + aToken.aText += '\"'; + aToken.aText += String(rChars); + aToken.aText += '\"'; +} + +void SmXMLStringContext_Impl::EndElement() +{ + GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_FIXED)); +} + +//////////////////////////////////////////////////////////// + +class SmXMLIdentifierContext_Impl : public SmXMLImportContext +{ +protected: + SmXMLContext_Helper aStyleHelper; + SmToken aToken; + +public: + SmXMLIdentifierContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName),aStyleHelper(*this) + { + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + aToken.eType = TIDENT; + } + + void TCharacters(const OUString &rChars); + void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) + { + aStyleHelper.RetrieveAttrs(xAttrList); + }; + void EndElement(); +}; + +void SmXMLIdentifierContext_Impl::EndElement() +{ + SmTextNode *pNode = 0; + //we will handle identifier italic/normal here instead of with a standalone + //font node + if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.Len() > 1)) + || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.Len() == 1))) + { + pNode = new SmTextNode(aToken,FNT_FUNCTION); + pNode->GetFont().SetItalic(ITALIC_NONE); + aStyleHelper.nIsItalic = -1; + } + else + pNode = new SmTextNode(aToken,FNT_VARIABLE); + if (aStyleHelper.bFontNodeNeeded && aStyleHelper.nIsItalic != -1) + { + if (aStyleHelper.nIsItalic) + pNode->GetFont().SetItalic(ITALIC_NORMAL); + else + pNode->GetFont().SetItalic(ITALIC_NONE); + } + + if ((-1!=aStyleHelper.nIsBold) || (0.0!=aStyleHelper.nFontSize) || + (aStyleHelper.sFontFamily.getLength()) || + aStyleHelper.sColor.getLength()) + aStyleHelper.bFontNodeNeeded=sal_True; + else + aStyleHelper.bFontNodeNeeded=sal_False; + if (aStyleHelper.bFontNodeNeeded) + aStyleHelper.ApplyAttrs(); + GetSmImport().GetNodeStack().Push(pNode); +} + +void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars) +{ + aToken.aText = rChars; +} + +//////////////////////////////////////////////////////////// + +class SmXMLOperatorContext_Impl : public SmXMLImportContext +{ + sal_Bool bIsStretchy; + +protected: + SmToken aToken; + +public: + SmXMLOperatorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName), bIsStretchy(sal_False) + { + aToken.nGroup = 0; + aToken.eType = TSPECIAL; + aToken.nLevel = 5; + } + + void TCharacters(const OUString &rChars); + void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); + void EndElement(); +}; + +void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars) +{ + aToken.cMathChar = rChars[0]; +} + +void SmXMLOperatorContext_Impl::EndElement() +{ + SmMathSymbolNode *pNode = new SmMathSymbolNode(aToken); + //For stretchy scaling the scaling must be retrieved from this node + //and applied to the expression itself so as to get the expression + //to scale the operator to the height of the expression itself + if (bIsStretchy) + pNode->SetScaleMode(SCALE_HEIGHT); + GetSmImport().GetNodeStack().Push(pNode); +} + + + +void SmXMLOperatorContext_Impl::StartElement(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for (sal_Int16 i=0;igetNameByIndex(i); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). + GetKeyByAttrName(sAttrName,&aLocalName); + + OUString sValue = xAttrList->getValueByIndex(i); + const SvXMLTokenMap &rAttrTokenMap = + GetSmImport().GetOperatorAttrTokenMap(); + switch(rAttrTokenMap.Get(nPrefix,aLocalName)) + { + case XML_TOK_STRETCHY: + bIsStretchy = sValue.equals( + GetXMLToken(XML_TRUE)); + break; + default: + break; + } + } +} + + +//////////////////////////////////////////////////////////// + +class SmXMLSpaceContext_Impl : public SmXMLImportContext +{ +public: + SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName) {} + + void StartElement(const uno::Reference< xml::sax::XAttributeList >& xAttrList ); +}; + +void SmXMLSpaceContext_Impl::StartElement( + const uno::Reference & /*xAttrList*/ ) +{ + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.eType = TBLANK; + aToken.nLevel = 5; + SmBlankNode *pBlank = new SmBlankNode(aToken); + pBlank->IncreaseBy(aToken); + GetSmImport().GetNodeStack().Push(pBlank); +} + +//////////////////////////////////////////////////////////// + +class SmXMLSubContext_Impl : public SmXMLRowContext_Impl +{ +protected: + void GenericEndElement(SmTokenType eType,SmSubSup aSubSup); + +public: + SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement() + { + GenericEndElement(TRSUB,RSUB); + } +}; + + +void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup) +{ + /*The element requires exactly 2 arguments.*/ + DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + "Sub has not two arguments"); + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = eType; + SmSubSupNode *pNode = new SmSubSupNode(aToken); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + + // initialize subnodes array + SmNodeArray aSubNodes; + aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); + for (ULONG i = 1; i < aSubNodes.size(); i++) + aSubNodes[i] = NULL; + + aSubNodes[eSubSup+1] = rNodeStack.Pop(); + aSubNodes[0] = rNodeStack.Pop(); + pNode->SetSubNodes(aSubNodes); + rNodeStack.Push(pNode); +} + +//////////////////////////////////////////////////////////// + +class SmXMLSupContext_Impl : public SmXMLSubContext_Impl +{ +public: + SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement() + { + GenericEndElement(TRSUP,RSUP); + } +}; + +//////////////////////////////////////////////////////////// + +class SmXMLSubSupContext_Impl : public SmXMLRowContext_Impl +{ +protected: + void GenericEndElement(SmTokenType eType, SmSubSup aSub,SmSubSup aSup); + +public: + SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement() + { + GenericEndElement(TRSUB,RSUB,RSUP); + } +}; + +void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, + SmSubSup aSub,SmSubSup aSup) +{ + /*The element requires exactly 3 arguments.*/ + DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3, + "SubSup has not three arguments"); + + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = eType; + SmSubSupNode *pNode = new SmSubSupNode(aToken); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + + // initialize subnodes array + SmNodeArray aSubNodes; + aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); + for (ULONG i = 1; i < aSubNodes.size(); i++) + aSubNodes[i] = NULL; + + aSubNodes[aSup+1] = rNodeStack.Pop(); + aSubNodes[aSub+1] = rNodeStack.Pop(); + aSubNodes[0] = rNodeStack.Pop(); + pNode->SetSubNodes(aSubNodes); + rNodeStack.Push(pNode); +} + +//////////////////////////////////////////////////////////// + +class SmXMLUnderContext_Impl : public SmXMLSubContext_Impl +{ +protected: + sal_Int16 nAttrCount; + +public: + SmXMLUnderContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} + + void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); + void EndElement(); + void HandleAccent(); +}; + +void SmXMLUnderContext_Impl::StartElement(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ + nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; +} + +void SmXMLUnderContext_Impl::HandleAccent() +{ + DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + "Sub has not two arguments"); + + /*Just one special case for the underline thing*/ + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + SmNode *pTest = rNodeStack.Pop(); + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TUNDERLINE; + + + SmNodeArray aSubNodes; + aSubNodes.resize(2); + + SmStructureNode *pNode = new SmAttributNode(aToken); + if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332) + { + aSubNodes[0] = new SmRectangleNode(aToken); + delete pTest; + } + else + aSubNodes[0] = pTest; + + aSubNodes[1] = rNodeStack.Pop(); + pNode->SetSubNodes(aSubNodes); + pNode->SetScaleMode(SCALE_WIDTH); + rNodeStack.Push(pNode); +} + + +void SmXMLUnderContext_Impl::EndElement() +{ + if (!nAttrCount) + GenericEndElement(TCSUB,CSUB); + else + HandleAccent(); +#if 0 + //UnderBrace trick + SmStructureNode *pNode = rNodeStack.Pop(); + if (pNode->GetSubNode(1)->GetToken().cMathChar == (0x0332|0xf000)) + if (pNode->GetSubNode(0)->GetToken().cMathChar == (0x0332|0xf000)) +#endif +} + +//////////////////////////////////////////////////////////// + +class SmXMLOverContext_Impl : public SmXMLSubContext_Impl +{ +protected: + sal_Int16 nAttrCount; + +public: + SmXMLOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLSubContext_Impl(rImport,nPrefix,rLName), nAttrCount(0) {} + + void EndElement(); + void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); + void HandleAccent(); +}; + + +void SmXMLOverContext_Impl::StartElement(const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) +{ + nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; +} + + +void SmXMLOverContext_Impl::EndElement() +{ + if (!nAttrCount) + GenericEndElement(TCSUP,CSUP); + else + HandleAccent(); +} + + +void SmXMLOverContext_Impl::HandleAccent() +{ + DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + "Sub has not two arguments"); + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TACUTE; + + SmAttributNode *pNode = new SmAttributNode(aToken); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + + SmNodeArray aSubNodes; + aSubNodes.resize(2); + aSubNodes[0] = rNodeStack.Pop(); + aSubNodes[1] = rNodeStack.Pop(); + pNode->SetSubNodes(aSubNodes); + pNode->SetScaleMode(SCALE_WIDTH); + rNodeStack.Push(pNode); + +} + +//////////////////////////////////////////////////////////// + +class SmXMLUnderOverContext_Impl : public SmXMLSubSupContext_Impl +{ +public: + SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {} + + void EndElement() + { + GenericEndElement(TCSUB,CSUB,CSUP); + } +}; + +//////////////////////////////////////////////////////////// + +class SmXMLMultiScriptsContext_Impl : public SmXMLSubSupContext_Impl +{ + sal_Bool bHasPrescripts; + +public: + SmXMLMultiScriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : + SmXMLSubSupContext_Impl(rImport,nPrefix,rLName), + bHasPrescripts(FALSE) {} + + void EndElement(); + void MiddleElement(); + SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > &xAttrList); +}; + +//////////////////////////////////////////////////////////// + +class SmXMLNoneContext_Impl : public SmXMLImportContext +{ +public: + SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName) {} + + void EndElement(); +}; + + +void SmXMLNoneContext_Impl::EndElement(void) +{ + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.aText.Erase(); + aToken.nLevel = 5; + aToken.eType = TIDENT; + GetSmImport().GetNodeStack().Push( + new SmTextNode(aToken,FNT_VARIABLE)); +} + +//////////////////////////////////////////////////////////// + +class SmXMLPrescriptsContext_Impl : public SmXMLImportContext +{ +public: + SmXMLPrescriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) + : SmXMLImportContext(rImport,nPrefix,rLName) {} +}; + +//////////////////////////////////////////////////////////// + +class SmXMLTableRowContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLTableRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : + SmXMLRowContext_Impl(rImport,nPrefix,rLName) + {} + + SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > &xAttrList); +}; + + +//////////////////////////////////////////////////////////// + +class SmXMLTableContext_Impl : public SmXMLTableRowContext_Impl +{ +public: + SmXMLTableContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : + SmXMLTableRowContext_Impl(rImport,nPrefix,rLName) + {} + + void EndElement(); + SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > &xAttrList); +}; + + +//////////////////////////////////////////////////////////// + +class SmXMLTableCellContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLTableCellContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : + SmXMLRowContext_Impl(rImport,nPrefix,rLName) + {} +}; + +//////////////////////////////////////////////////////////// + +class SmXMLAlignGroupContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLAlignGroupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : + SmXMLRowContext_Impl(rImport,nPrefix,rLName) + {} + + /*Don't do anything with alignment for now*/ + void EndElement() + { + } +}; + +//////////////////////////////////////////////////////////// + +class SmXMLActionContext_Impl : public SmXMLRowContext_Impl +{ +public: + SmXMLActionContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, + const OUString& rLName) : + SmXMLRowContext_Impl(rImport,nPrefix,rLName) + {} + + void EndElement(); +}; + +//////////////////////////////////////////////////////////// + +// NB: virtually inherit so we can multiply inherit properly +// in SmXMLFlatDocContext_Impl +class SmXMLOfficeContext_Impl : public virtual SvXMLImportContext +{ +public: + SmXMLOfficeContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx, + const OUString& rLName) + : SvXMLImportContext(rImport,nPrfx,rLName) {} + + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); +}; + +SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > &xAttrList) +{ + SvXMLImportContext *pContext = 0; + if ( XML_NAMESPACE_OFFICE == nPrefix && + rLocalName == GetXMLToken(XML_META) ) + { + DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?"); + } + else if ( XML_NAMESPACE_OFFICE == nPrefix && + rLocalName == GetXMLToken(XML_SETTINGS) ) + { + pContext = new XMLDocumentSettingsContext( GetImport(), + XML_NAMESPACE_OFFICE, rLocalName, + xAttrList ); + } + else + pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); + + return pContext; +} + +//////////////////////////////////////////////////////////// + +// context for flat file xml format +class SmXMLFlatDocContext_Impl + : public SmXMLOfficeContext_Impl, public SvXMLMetaDocumentContext +{ +public: + SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, + USHORT i_nPrefix, const OUString & i_rLName, + const uno::Reference& i_xDocProps, + const uno::Reference& i_xDocBuilder); + + virtual ~SmXMLFlatDocContext_Impl(); + + virtual SvXMLImportContext *CreateChildContext(USHORT i_nPrefix, const OUString& i_rLocalName, const uno::Reference& i_xAttrList); +}; + +SmXMLFlatDocContext_Impl::SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, + USHORT i_nPrefix, const OUString & i_rLName, + const uno::Reference& i_xDocProps, + const uno::Reference& i_xDocBuilder) : + SvXMLImportContext(i_rImport, i_nPrefix, i_rLName), + SmXMLOfficeContext_Impl(i_rImport, i_nPrefix, i_rLName), + SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName, + i_xDocProps, i_xDocBuilder) +{ +} + +SmXMLFlatDocContext_Impl::~SmXMLFlatDocContext_Impl() +{ +} + +SvXMLImportContext *SmXMLFlatDocContext_Impl::CreateChildContext( + USHORT i_nPrefix, const OUString& i_rLocalName, + const uno::Reference& i_xAttrList) +{ + // behave like meta base class iff we encounter office:meta + if ( XML_NAMESPACE_OFFICE == i_nPrefix && + i_rLocalName == GetXMLToken(XML_META) ) + { + return SvXMLMetaDocumentContext::CreateChildContext( + i_nPrefix, i_rLocalName, i_xAttrList ); + } + else + { + return SmXMLOfficeContext_Impl::CreateChildContext( + i_nPrefix, i_rLocalName, i_xAttrList ); + } +} + +//////////////////////////////////////////////////////////// + +static __FAR_DATA SvXMLTokenMapEntry aPresLayoutElemTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_SEMANTICS, XML_TOK_SEMANTICS }, + { XML_NAMESPACE_MATH, XML_MATH, XML_TOK_MATH }, + { XML_NAMESPACE_MATH, XML_MSTYLE, XML_TOK_MSTYLE }, + { XML_NAMESPACE_MATH, XML_MERROR, XML_TOK_MERROR }, + { XML_NAMESPACE_MATH, XML_MPHANTOM, XML_TOK_MPHANTOM }, + { XML_NAMESPACE_MATH, XML_MROW, XML_TOK_MROW }, + { XML_NAMESPACE_MATH, XML_MFRAC, XML_TOK_MFRAC }, + { XML_NAMESPACE_MATH, XML_MSQRT, XML_TOK_MSQRT }, + { XML_NAMESPACE_MATH, XML_MROOT, XML_TOK_MROOT }, + { XML_NAMESPACE_MATH, XML_MSUB, XML_TOK_MSUB }, + { XML_NAMESPACE_MATH, XML_MSUP, XML_TOK_MSUP }, + { XML_NAMESPACE_MATH, XML_MSUBSUP, XML_TOK_MSUBSUP }, + { XML_NAMESPACE_MATH, XML_MUNDER, XML_TOK_MUNDER }, + { XML_NAMESPACE_MATH, XML_MOVER, XML_TOK_MOVER }, + { XML_NAMESPACE_MATH, XML_MUNDEROVER, XML_TOK_MUNDEROVER }, + { XML_NAMESPACE_MATH, XML_MMULTISCRIPTS, XML_TOK_MMULTISCRIPTS }, + { XML_NAMESPACE_MATH, XML_MTABLE, XML_TOK_MTABLE }, + { XML_NAMESPACE_MATH, XML_MACTION, XML_TOK_MACTION }, + { XML_NAMESPACE_MATH, XML_MFENCED, XML_TOK_MFENCED }, + { XML_NAMESPACE_MATH, XML_MPADDED, XML_TOK_MPADDED }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aPresLayoutAttrTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_FONTWEIGHT, XML_TOK_FONTWEIGHT }, + { XML_NAMESPACE_MATH, XML_FONTSTYLE, XML_TOK_FONTSTYLE }, + { XML_NAMESPACE_MATH, XML_FONTSIZE, XML_TOK_FONTSIZE }, + { XML_NAMESPACE_MATH, XML_FONTFAMILY, XML_TOK_FONTFAMILY }, + { XML_NAMESPACE_MATH, XML_COLOR, XML_TOK_COLOR }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aFencedAttrTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_OPEN, XML_TOK_OPEN }, + { XML_NAMESPACE_MATH, XML_CLOSE, XML_TOK_CLOSE }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aOperatorAttrTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_STRETCHY, XML_TOK_STRETCHY }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aAnnotationAttrTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_ENCODING, XML_TOK_ENCODING }, + XML_TOKEN_MAP_END +}; + + +static __FAR_DATA SvXMLTokenMapEntry aPresElemTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_ANNOTATION, XML_TOK_ANNOTATION }, + { XML_NAMESPACE_MATH, XML_MI, XML_TOK_MI }, + { XML_NAMESPACE_MATH, XML_MN, XML_TOK_MN }, + { XML_NAMESPACE_MATH, XML_MO, XML_TOK_MO }, + { XML_NAMESPACE_MATH, XML_MTEXT, XML_TOK_MTEXT }, + { XML_NAMESPACE_MATH, XML_MSPACE,XML_TOK_MSPACE }, + { XML_NAMESPACE_MATH, XML_MS, XML_TOK_MS }, + { XML_NAMESPACE_MATH, XML_MALIGNGROUP, XML_TOK_MALIGNGROUP }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aPresScriptEmptyElemTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_MPRESCRIPTS, XML_TOK_MPRESCRIPTS }, + { XML_NAMESPACE_MATH, XML_NONE, XML_TOK_NONE }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aPresTableElemTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_MTR, XML_TOK_MTR }, + { XML_NAMESPACE_MATH, XML_MTD, XML_TOK_MTD }, + XML_TOKEN_MAP_END +}; + +static __FAR_DATA SvXMLTokenMapEntry aColorTokenMap[] = +{ + { XML_NAMESPACE_MATH, XML_BLACK, TBLACK}, + { XML_NAMESPACE_MATH, XML_WHITE, TWHITE}, + { XML_NAMESPACE_MATH, XML_RED, TRED}, + { XML_NAMESPACE_MATH, XML_GREEN, TGREEN}, + { XML_NAMESPACE_MATH, XML_BLUE, TBLUE}, + { XML_NAMESPACE_MATH, XML_AQUA, TCYAN}, + { XML_NAMESPACE_MATH, XML_FUCHSIA, TMAGENTA}, + { XML_NAMESPACE_MATH, XML_YELLOW, TYELLOW}, + XML_TOKEN_MAP_END +}; + + +//////////////////////////////////////////////////////////// + +const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap() +{ + if (!pPresLayoutElemTokenMap) + pPresLayoutElemTokenMap = new SvXMLTokenMap(aPresLayoutElemTokenMap); + return *pPresLayoutElemTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap() +{ + if (!pPresLayoutAttrTokenMap) + pPresLayoutAttrTokenMap = new SvXMLTokenMap(aPresLayoutAttrTokenMap); + return *pPresLayoutAttrTokenMap; +} + + +const SvXMLTokenMap& SmXMLImport::GetFencedAttrTokenMap() +{ + if (!pFencedAttrTokenMap) + pFencedAttrTokenMap = new SvXMLTokenMap(aFencedAttrTokenMap); + return *pFencedAttrTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetOperatorAttrTokenMap() +{ + if (!pOperatorAttrTokenMap) + pOperatorAttrTokenMap = new SvXMLTokenMap(aOperatorAttrTokenMap); + return *pOperatorAttrTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetAnnotationAttrTokenMap() +{ + if (!pAnnotationAttrTokenMap) + pAnnotationAttrTokenMap = new SvXMLTokenMap(aAnnotationAttrTokenMap); + return *pAnnotationAttrTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetPresElemTokenMap() +{ + if (!pPresElemTokenMap) + pPresElemTokenMap = new SvXMLTokenMap(aPresElemTokenMap); + return *pPresElemTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetPresScriptEmptyElemTokenMap() +{ + if (!pPresScriptEmptyElemTokenMap) + pPresScriptEmptyElemTokenMap = new + SvXMLTokenMap(aPresScriptEmptyElemTokenMap); + return *pPresScriptEmptyElemTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetPresTableElemTokenMap() +{ + if (!pPresTableElemTokenMap) + pPresTableElemTokenMap = new SvXMLTokenMap(aPresTableElemTokenMap); + return *pPresTableElemTokenMap; +} + +const SvXMLTokenMap& SmXMLImport::GetColorTokenMap() +{ + if (!pColorTokenMap) + pColorTokenMap = new SvXMLTokenMap(aColorTokenMap); + return *pColorTokenMap; +} + +//////////////////////////////////////////////////////////// + +SvXMLImportContext *SmXMLDocContext_Impl::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference& xAttrList) +{ + SvXMLImportContext* pContext = 0L; + + const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresLayoutElemTokenMap(); + + //UINT32 nTest = rTokenMap.Get(nPrefix, rLocalName); + + switch(rTokenMap.Get(nPrefix, rLocalName)) + { + //Consider semantics a dummy except for any starmath annotations + case XML_TOK_SEMANTICS: + pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName, + xAttrList); + break; + /*General Layout Schemata*/ + case XML_TOK_MROW: + pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MFRAC: + pContext = GetSmImport().CreateFracContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MSQRT: + pContext = GetSmImport().CreateSqrtContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MROOT: + pContext = GetSmImport().CreateRootContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MSTYLE: + pContext = GetSmImport().CreateStyleContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MERROR: + pContext = GetSmImport().CreateErrorContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MPADDED: + pContext = GetSmImport().CreatePaddedContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MPHANTOM: + pContext = GetSmImport().CreatePhantomContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MFENCED: + pContext = GetSmImport().CreateFencedContext(nPrefix,rLocalName, + xAttrList); + break; + /*Script and Limit Schemata*/ + case XML_TOK_MSUB: + pContext = GetSmImport().CreateSubContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MSUP: + pContext = GetSmImport().CreateSupContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MSUBSUP: + pContext = GetSmImport().CreateSubSupContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MUNDER: + pContext = GetSmImport().CreateUnderContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MOVER: + pContext = GetSmImport().CreateOverContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MUNDEROVER: + pContext = GetSmImport().CreateUnderOverContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MMULTISCRIPTS: + pContext = GetSmImport().CreateMultiScriptsContext(nPrefix, + rLocalName, xAttrList); + break; + case XML_TOK_MTABLE: + pContext = GetSmImport().CreateTableContext(nPrefix, + rLocalName, xAttrList); + break; + case XML_TOK_MACTION: + pContext = GetSmImport().CreateActionContext(nPrefix, + rLocalName, xAttrList); + break; + default: + /*Basically theres an implicit mrow around certain bare + *elements, use a RowContext to see if this is one of + *those ones*/ + SmXMLRowContext_Impl aTempContext(GetSmImport(),nPrefix, + GetXMLToken(XML_MROW)); + + pContext = aTempContext.StrictCreateChildContext(nPrefix, + rLocalName, xAttrList); + break; + } + return pContext; +} + +void SmXMLDocContext_Impl::EndElement() +{ + SmNodeArray ContextArray; + ContextArray.resize(1); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + + for (ULONG i=0;i< 1;i++) + ContextArray[i] = rNodeStack.Pop(); + + SmToken aDummy; + SmStructureNode *pSNode = new SmLineNode(aDummy); + pSNode->SetSubNodes(ContextArray); + rNodeStack.Push(pSNode); + + SmNodeArray LineArray; + ULONG n = rNodeStack.Count(); + LineArray.resize(n); + for (ULONG j = 0; j < n; j++) + LineArray[n - (j + 1)] = rNodeStack.Pop(); + SmStructureNode *pSNode2 = new SmTableNode(aDummy); + pSNode2->SetSubNodes(LineArray); + rNodeStack.Push(pSNode2); +} + +void SmXMLFracContext_Impl::EndElement() +{ + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TOVER; + SmStructureNode *pSNode = new SmBinVerNode(aToken); + SmNode *pOper = new SmRectangleNode(aToken); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + DBG_ASSERT(rNodeStack.Count() - nElementCount == 2, + "Fraction (mfrac) tag is missing component"); + if (rNodeStack.Count() - nElementCount == 2) + { + SmNode *pSecond = rNodeStack.Pop(); + SmNode *pFirst = rNodeStack.Pop(); + pSNode->SetSubNodes(pFirst,pOper,pSecond); + rNodeStack.Push(pSNode); + } +} + +void SmXMLRootContext_Impl::EndElement() +{ + /*The element requires exactly 2 arguments.*/ + DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + "Root tag is missing component"); + + SmToken aToken; + aToken.cMathChar = MS_SQRT; //Temporary: alert, based on OpenSymbol font + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TNROOT; + SmStructureNode *pSNode = new SmRootNode(aToken); + SmNode *pOper = new SmRootSymbolNode(aToken); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + SmNode *pIndex = rNodeStack.Pop(); + SmNode *pBase = rNodeStack.Pop(); + pSNode->SetSubNodes(pIndex,pOper,pBase); + rNodeStack.Push(pSNode); +} + +void SmXMLSqrtContext_Impl::EndElement() +{ + /* + accepts any number of arguments; if this number is not 1, its + contents are treated as a single "inferred " containing its + arguments + */ + if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) + SmXMLRowContext_Impl::EndElement(); + + SmToken aToken; + aToken.cMathChar = MS_SQRT; //Temporary: alert, based on OpenSymbol font + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TSQRT; + SmStructureNode *pSNode = new SmRootNode(aToken); + SmNode *pOper = new SmRootSymbolNode(aToken); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + pSNode->SetSubNodes(0,pOper,rNodeStack.Pop()); + rNodeStack.Push(pSNode); +} + +void SmXMLRowContext_Impl::EndElement() +{ + SmNodeArray aRelationArray; + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + ULONG nSize = rNodeStack.Count()-nElementCount; + + if (nSize > 0) + { + aRelationArray.resize(nSize); + for (ULONG j=rNodeStack.Count()-nElementCount;j > 0;j--) + aRelationArray[j-1] = rNodeStack.Pop(); + + + //If the first or last element is an operator with stretchyness + //set then we must create a brace node here from those elements, + //removing the stretchness from the operators and applying it to + //ourselves, and creating the appropiate dummy StarMath none bracket + //to balance the arrangement + if (((aRelationArray[0]->GetScaleMode() == SCALE_HEIGHT) + && (aRelationArray[0]->GetType() == NMATH)) + || ((aRelationArray[nSize-1]->GetScaleMode() == SCALE_HEIGHT) + && (aRelationArray[nSize-1]->GetType() == NMATH))) + { + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + + int nLeft=0,nRight=0; + if ((aRelationArray[0]->GetScaleMode() == SCALE_HEIGHT) + && (aRelationArray[0]->GetType() == NMATH)) + { + aToken = aRelationArray[0]->GetToken(); + nLeft=1; + } + else + aToken.cMathChar = '\0'; + + aToken.eType = TLPARENT; + SmNode *pLeft = new SmMathSymbolNode(aToken); + + if ((aRelationArray[nSize-1]->GetScaleMode() == SCALE_HEIGHT) + && (aRelationArray[nSize-1]->GetType() == NMATH)) + { + aToken = aRelationArray[nSize-1]->GetToken(); + nRight=1; + } + else + aToken.cMathChar = '\0'; + + aToken.eType = TRPARENT; + SmNode *pRight = new SmMathSymbolNode(aToken); + + SmNodeArray aRelationArray2; + + //!! nSize-nLeft-nRight may be < 0 !! + int nRelArrSize = nSize-nLeft-nRight; + if (nRelArrSize > 0) + { + aRelationArray2.resize(nRelArrSize); + for (int i=0;i < nRelArrSize;i++) + aRelationArray2[i] = aRelationArray[i+nLeft]; + } + + SmToken aDummy; + SmStructureNode *pSNode = new SmBraceNode(aToken); + SmStructureNode *pBody = new SmExpressionNode(aDummy); + pBody->SetSubNodes(aRelationArray2); + + pSNode->SetSubNodes(pLeft,pBody,pRight); + pSNode->SetScaleMode(SCALE_HEIGHT); + rNodeStack.Push(pSNode); + return; + } + } + else //Multiple newlines result in empty row elements + { + aRelationArray.resize(1); + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 5; + aToken.eType = TNEWLINE; + aRelationArray[0] = new SmLineNode(aToken); + } + + SmToken aDummy; + SmStructureNode *pSNode = new SmExpressionNode(aDummy); + pSNode->SetSubNodes(aRelationArray); + rNodeStack.Push(pSNode); +} + + +SvXMLImportContext *SmXMLRowContext_Impl::StrictCreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference& xAttrList) +{ + SvXMLImportContext* pContext = 0L; + + const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresElemTokenMap(); + switch(rTokenMap.Get(nPrefix, rLocalName)) + { + /*Note that these should accept malignmark subelements, but do not*/ + case XML_TOK_MN: + pContext = GetSmImport().CreateNumberContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MI: + pContext = GetSmImport().CreateIdentifierContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MO: + pContext = GetSmImport().CreateOperatorContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MTEXT: + pContext = GetSmImport().CreateTextContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MSPACE: + pContext = GetSmImport().CreateSpaceContext(nPrefix,rLocalName, + xAttrList); + break; + case XML_TOK_MS: + pContext = GetSmImport().CreateStringContext(nPrefix,rLocalName, + xAttrList); + break; + + /*Note: The maligngroup should only be seen when the row + * (or decendants) are in a table*/ + case XML_TOK_MALIGNGROUP: + pContext = GetSmImport().CreateAlignGroupContext(nPrefix,rLocalName, + xAttrList); + break; + + case XML_TOK_ANNOTATION: + pContext = GetSmImport().CreateAnnotationContext(nPrefix,rLocalName, + xAttrList); + break; + + default: + break; + } + return pContext; +} + + +SvXMLImportContext *SmXMLRowContext_Impl::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference& xAttrList) +{ + SvXMLImportContext* pContext = StrictCreateChildContext(nPrefix, + rLocalName, xAttrList); + + if (!pContext) + { + //Hmm, unrecognized for this level, check to see if its + //an element that can have an implicit schema around it + pContext = SmXMLDocContext_Impl::CreateChildContext(nPrefix, + rLocalName,xAttrList); + } + return pContext; +} + + +SvXMLImportContext *SmXMLMultiScriptsContext_Impl::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference& xAttrList) +{ + SvXMLImportContext* pContext = 0L; + + const SvXMLTokenMap& rTokenMap = GetSmImport(). + GetPresScriptEmptyElemTokenMap(); + switch(rTokenMap.Get(nPrefix, rLocalName)) + { + case XML_TOK_MPRESCRIPTS: + MiddleElement(); + pContext = GetSmImport().CreatePrescriptsContext(nPrefix, + rLocalName, xAttrList); + break; + case XML_TOK_NONE: + pContext = GetSmImport().CreateNoneContext(nPrefix,rLocalName, + xAttrList); + break; + default: + pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix, + rLocalName,xAttrList); + break; + } + return pContext; +} + +void SmXMLMultiScriptsContext_Impl::MiddleElement() +{ + bHasPrescripts=sal_True; + + DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0, + "Sub has no arguments"); + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + if (rNodeStack.Count()-nElementCount > 1) + { + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TRSUB; + ULONG nFinalCount = rNodeStack.Count()-nElementCount-1; + + SmNodeStack aReverseStack; + while (rNodeStack.Count()-nElementCount) + { + SmNode *pThing = rNodeStack.Pop(); + aReverseStack.Push(pThing); + } + + for (ULONG nCount=0;nCount < nFinalCount;nCount+=2) + { + SmSubSupNode *pNode = new SmSubSupNode(aToken); + + // initialize subnodes array + SmNodeArray aSubNodes; + aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); + for (ULONG i = 1; i < aSubNodes.size(); i++) + aSubNodes[i] = NULL; + + /*On each loop the base and its sub sup pair becomes the + base for the next loop to which the next sub sup pair is + attached, i.e. wheels within wheels*/ + //if (nCount == 0) + aSubNodes[0] = aReverseStack.Pop(); + + SmNode *pScriptNode = aReverseStack.Pop(); + + if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || + (pScriptNode->GetToken().aText.Len()))) + aSubNodes[RSUB+1] = pScriptNode; + pScriptNode = aReverseStack.Pop(); + if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || + (pScriptNode->GetToken().aText.Len()))) + aSubNodes[RSUP+1] = pScriptNode; + + pNode->SetSubNodes(aSubNodes); + aReverseStack.Push(pNode); + } + rNodeStack.Push(aReverseStack.Pop()); + } +} + + +void SmXMLTableContext_Impl::EndElement() +{ + SmNodeArray aExpressionArray; + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + SmNodeStack aReverseStack; + aExpressionArray.resize(rNodeStack.Count()-nElementCount); + + ULONG nRows = rNodeStack.Count()-nElementCount; + USHORT nCols = 0; + + SmStructureNode *pArray; + for (ULONG i=rNodeStack.Count()-nElementCount;i > 0;i--) + { + pArray = (SmStructureNode *)rNodeStack.Pop(); + if (pArray->GetNumSubNodes() == 0) + { + //This is a little tricky, it is possible that there was + //be elements that were not inside a pair, in which + //case they will not be in a row, i.e. they will not have + //SubNodes, so we have to wait until here before we can + //resolve the situation. Implicitsurrounding tags are + //surprisingly difficult to get right within this + //architecture + + SmNodeArray aRelationArray; + aRelationArray.resize(1); + aRelationArray[0] = pArray; + SmToken aDummy; + pArray = new SmExpressionNode(aDummy); + pArray->SetSubNodes(aRelationArray); + } + + if (pArray->GetNumSubNodes() > nCols) + nCols = pArray->GetNumSubNodes(); + aReverseStack.Push(pArray); + } + aExpressionArray.resize(nCols*nRows); + ULONG j=0; + while (aReverseStack.Count()) + { + pArray = (SmStructureNode *)aReverseStack.Pop(); + for (USHORT i=0;iGetNumSubNodes();i++) + aExpressionArray[j++] = pArray->GetSubNode(i); + } + + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = TRGROUP; + aToken.nLevel = 0; + aToken.eType = TMATRIX; + SmMatrixNode *pSNode = new SmMatrixNode(aToken); + pSNode->SetSubNodes(aExpressionArray); + pSNode->SetRowCol(static_cast(nRows),nCols); + rNodeStack.Push(pSNode); +} + +SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference& xAttrList) +{ + SvXMLImportContext* pContext = 0L; + + const SvXMLTokenMap& rTokenMap = GetSmImport(). + GetPresTableElemTokenMap(); + switch(rTokenMap.Get(nPrefix, rLocalName)) + { + case XML_TOK_MTD: + pContext = GetSmImport().CreateTableCellContext(nPrefix, + rLocalName, xAttrList); + break; + default: + pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix, + rLocalName,xAttrList); + break; + } + return pContext; +} + +SvXMLImportContext *SmXMLTableContext_Impl::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference& xAttrList) +{ + SvXMLImportContext* pContext = 0L; + + const SvXMLTokenMap& rTokenMap = GetSmImport(). + GetPresTableElemTokenMap(); + switch(rTokenMap.Get(nPrefix, rLocalName)) + { + case XML_TOK_MTR: + pContext = GetSmImport().CreateTableRowContext(nPrefix,rLocalName, + xAttrList); + break; + default: + pContext = SmXMLTableRowContext_Impl::CreateChildContext(nPrefix, + rLocalName,xAttrList); + break; + } + return pContext; +} + +void SmXMLMultiScriptsContext_Impl::EndElement() +{ + if (!bHasPrescripts) + MiddleElement(); + + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + if (rNodeStack.Count()-nElementCount > 1) + { + SmToken aToken; + aToken.cMathChar = '\0'; + aToken.nGroup = 0; + aToken.nLevel = 0; + aToken.eType = TLSUB; + ULONG nFinalCount = rNodeStack.Count()-nElementCount-1; + + SmNodeStack aReverseStack; + while (rNodeStack.Count()-nElementCount) + aReverseStack.Push(rNodeStack.Pop()); + for (ULONG nCount=0;nCount < nFinalCount;nCount+=2) + { + SmSubSupNode *pNode = new SmSubSupNode(aToken); + + // initialize subnodes array + SmNodeArray aSubNodes; + aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); + for (ULONG i = 1; i < aSubNodes.size(); i++) + aSubNodes[i] = NULL; + + /*On each loop the base and its sub sup pair becomes the + base for the next loop to which the next sub sup pair is + attached, i.e. wheels within wheels*/ + //if (nCount == 0) + aSubNodes[0] = aReverseStack.Pop(); + + SmNode *pScriptNode = aReverseStack.Pop(); + if (pScriptNode->GetToken().aText.Len()) + aSubNodes[LSUB+1] = pScriptNode; + pScriptNode = aReverseStack.Pop(); + if (pScriptNode->GetToken().aText.Len()) + aSubNodes[LSUP+1] = pScriptNode; + + pNode->SetSubNodes(aSubNodes); + aReverseStack.Push(pNode); + } + rNodeStack.Push(aReverseStack.Pop()); + } + +} +void SmXMLActionContext_Impl::EndElement() +{ + /*For now we will just assume that the + selected attribute is one, and then just display + that expression alone, i.e. remove all expect the + first pushed one*/ + + SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); + for (ULONG i=rNodeStack.Count()-nElementCount;i > 1;i--) + { + delete rNodeStack.Pop(); + } +} + +SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + if ( XML_NAMESPACE_OFFICE == nPrefix ) + { + if ( (IsXMLToken(rLocalName, XML_DOCUMENT) || + IsXMLToken(rLocalName, XML_DOCUMENT_META))) + { + uno::Reference xDocBuilder( + mxServiceFactory->createInstance( + ::rtl::OUString::createFromAscii( + "com.sun.star.xml.dom.SAXDocumentBuilder")), + uno::UNO_QUERY_THROW); + uno::Reference xDPS( + GetModel(), uno::UNO_QUERY_THROW); + return IsXMLToken(rLocalName, XML_DOCUMENT_META) + ? new SvXMLMetaDocumentContext(*this, + XML_NAMESPACE_OFFICE, rLocalName, + xDPS->getDocumentProperties(), xDocBuilder) + // flat OpenDocument file format -- this has not been tested... + : new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName, + xDPS->getDocumentProperties(), xDocBuilder); + } + else + { + return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName); + } + } + else + return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateRowContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLRowContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateTextContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLTextContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateAnnotationContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLAnnotationContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateStringContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLStringContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateNumberContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLNumberContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateIdentifierContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLIdentifierContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateOperatorContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLOperatorContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateSpaceContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLSpaceContext_Impl(*this,nPrefix,rLocalName); +} + + +SvXMLImportContext *SmXMLImport::CreateFracContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLFracContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateSqrtContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLSqrtContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateRootContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLRootContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateStyleContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLStyleContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreatePaddedContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLPaddedContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreatePhantomContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLPhantomContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateFencedContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLFencedContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateErrorContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLErrorContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateSubContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLSubContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateSubSupContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLSubSupContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateSupContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLSupContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateUnderContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLUnderContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateOverContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLOverContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateUnderOverContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLUnderOverContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateMultiScriptsContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLMultiScriptsContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateTableContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLTableContext_Impl(*this,nPrefix,rLocalName); +} +SvXMLImportContext *SmXMLImport::CreateTableRowContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLTableRowContext_Impl(*this,nPrefix,rLocalName); +} +SvXMLImportContext *SmXMLImport::CreateTableCellContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLTableCellContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateNoneContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLNoneContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreatePrescriptsContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLPrescriptsContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateAlignGroupContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLAlignGroupContext_Impl(*this,nPrefix,rLocalName); +} + +SvXMLImportContext *SmXMLImport::CreateActionContext(sal_uInt16 nPrefix, + const OUString &rLocalName, + const uno::Reference & /*xAttrList*/) +{ + return new SmXMLActionContext_Impl(*this,nPrefix,rLocalName); +} + +SmXMLImport::~SmXMLImport() throw () +{ + delete pPresLayoutElemTokenMap; + delete pPresElemTokenMap; + delete pPresScriptEmptyElemTokenMap; + delete pPresTableElemTokenMap; + delete pPresLayoutAttrTokenMap; + delete pFencedAttrTokenMap; + delete pColorTokenMap; + delete pOperatorAttrTokenMap; + delete pAnnotationAttrTokenMap; +} + +void SmXMLImport::SetViewSettings(const Sequence& aViewProps) +{ + uno::Reference xModel = GetModel(); + if ( !xModel.is() ) + return; + + uno::Reference xTunnel; + xTunnel = uno::Reference (xModel,uno::UNO_QUERY); + SmModel *pModel = reinterpret_cast + (xTunnel->getSomething(SmModel::getUnoTunnelId())); + + if ( !pModel ) + return; + + SmDocShell *pDocShell = + static_cast(pModel->GetObjectShell()); + if ( !pDocShell ) + return; + + Rectangle aRect( pDocShell->GetVisArea() ); + + sal_Int32 nCount = aViewProps.getLength(); + const PropertyValue *pValue = aViewProps.getConstArray(); + + long nTmp = 0; + //sal_Bool bShowDeletes = sal_False, bShowInserts = sal_False, bShowFooter = sal_False, bShowHeader = sal_False; + + for (sal_Int32 i = 0; i < nCount ; i++) + { + if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaTop" ) ) ) + { + pValue->Value >>= nTmp; + aRect.setY( nTmp ); + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaLeft" ) ) ) + { + pValue->Value >>= nTmp; + aRect.setX( nTmp ); + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaWidth" ) ) ) + { + pValue->Value >>= nTmp; + Size aSize( aRect.GetSize() ); + aSize.Width() = nTmp; + aRect.SetSize( aSize ); + } + else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaHeight" ) ) ) + { + pValue->Value >>= nTmp; + Size aSize( aRect.GetSize() ); + aSize.Height() = nTmp; + aRect.SetSize( aSize ); + } + pValue++; + } + + pDocShell->SetVisArea ( aRect ); +} + +void SmXMLImport::SetConfigurationSettings(const Sequence& aConfProps) +{ + uno::Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY ); + if ( xProps.is() ) + { + Reference < XPropertySetInfo > xInfo ( xProps->getPropertySetInfo() ); + if (xInfo.is() ) + { + sal_Int32 nCount = aConfProps.getLength(); + const PropertyValue* pValues = aConfProps.getConstArray(); + + const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) ); + const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) ); + const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) ); + while ( nCount-- ) + { + if (pValues->Name != sFormula && + pValues->Name != sBasicLibraries && + pValues->Name != sDialogLibraries) + { + try + { + if ( xInfo->hasPropertyByName( pValues->Name ) ) + xProps->setPropertyValue( pValues->Name, pValues->Value ); + } + catch( Exception& ) + { + DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" ); + } + } + + pValues++; + } + } + } +} + + +//////////////////////////////////////////////////////////// + diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index ad3987549c0f..8159acd64362 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -1651,7 +1651,7 @@ void SmBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) "Sm : unterschiedliche Fontgroessen"); aTmpSize.Width() = Min((long) nBraceHeight * 60L / 100L, rFormat.GetBaseSize().Height() * 3L / 2L); - // correction factor since change from StarMath to StarSymbol font + // correction factor since change from StarMath to OpenSymbol font // because of the different font width in the FontMetric aTmpSize.Width() *= 182; aTmpSize.Width() /= 267; @@ -2694,7 +2694,7 @@ void SmMathSymbolNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocSh DBG_ASSERT(GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL || GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE, - "incorrect charset for character from StarMath/StarSymbol font"); + "incorrect charset for character from StarMath/OpenSymbol font"); Flags() |= FLG_FONT | FLG_ITALIC; }; diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index 0718be8ffd37..94d0761d7fce 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -150,8 +150,7 @@ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat, aSize = Size(rDev.GetTextWidth(rText), rDev.GetTextHeight()); const FontMetric aFM (rDev.GetFontMetric()); - BOOL bIsMath = aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH ) || - aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH2 ); + BOOL bIsMath = aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH ); BOOL bAllowSmaller = bIsMath && !SmIsMathAlpha(rText); const long nFontHeight = rDev.GetFont().GetSize().Height(); diff --git a/starmath/source/types.cxx b/starmath/source/types.cxx index 6a4fe919ae95..c86b4164928f 100644 --- a/starmath/source/types.cxx +++ b/starmath/source/types.cxx @@ -35,227 +35,21 @@ #include -//!! no official unicode code point for these in non-private-area -//!! (even MathMl uses the code points listed on the right which are -//!! from the private-use-area as well) -// MS_UNDERBRACE = (xub_Unicode) 0xE081, 0xF613 ? -// MS_OVERBRACE = (xub_Unicode) 0xE082, 0xF612 ? - -struct MathConversionEntry -{ - sal_Unicode cMath; // code point of the character from the - // StarSymbol/OpenSymbol private-use-area - sal_Unicode cUnicode; // 'official' Unicode code point the above - // character should be matched to and vice versa. - // See http://www.w3.org/TR/2000/WD-MathML2-20000211/bycodes.html - // for most of them. -// const sal_Unicode *pFontName; - sal_Unicode cMathType; // 0 if the same value of cUnicode is to be used -}; - -static MathConversionEntry aMathConvTbl[] = -{ -// MS_UNDERBRACE, 0xF613, // only Math-ML code-point available ! -// MS_OVERBRACE, 0xF612, // only Math-ML code-point available ! - { MS_PLUS, 0x002B, 0 }, - { MS_LT, 0x003C, 0 }, - { MS_GT, 0x003E, 0 }, - { MS_LESLANT, 0x2264, 0 }, - { MS_GESLANT, 0x2265, 0 }, - { MS_DOTSLOW, 0x2026, 0 }, - { MS_RIGHTARROW, 0x2192, 0 }, - { MS_SQRT, 0x221A, 0 }, - { MS_HAT, 0x02C6, 0 }, - { MS_CHECK, 0x02C7, 0 }, - { MS_BREVE, 0x02D8, 0 }, - { MS_ACUTE, 0x00B4, 0 }, - { MS_GRAVE, 0x0060, 0 }, - { MS_TILDE, 0x02DC, 0 }, - { MS_BAR, 0x02C9, 0 }, - { MS_VEC, 0x2192, 0 }, - { MS_DDDOT, 0x22EF, 0 }, - { MS_LPARENT, 0x0028, 0 }, - { MS_RPARENT, 0x0029, 0 }, - { MS_PLACE, 0x25A1, 0 }, - { MS_LEFTARROW, 0x2190, 0 }, - { MS_UPARROW, 0x2191, 0 }, - { MS_DOWNARROW, 0x2193, 0 }, - { MS_PLACE, 0x2751, 0 }, - - // predefined-user-defined symbols - // (code-points on the left as defined in 'officecfg' for SO8, - // non-private-use-area characters uncommented): - -// 0x0041, 0x0391, 0, // %ALPHA -// 0x0042, 0x0392, 0, // %BETA - { 0xE0AC, 0x0393, 0 }, // %GAMMA - { 0xE0AD, 0x0394, 0 }, // %DELTA -// 0x0045, 0x0395, 0, // %EPSILON -// 0x005A, 0x0396, 0, // %ZETA -// 0x0048, 0x0397, 0, // %ETA - { 0xE0AE, 0x0398, 0 }, // %THETA -// 0x0049, 0x0399, 0, // %IOTA -// 0x004B, 0x039A, 0, // %KAPPA - { 0xE0AF, 0x039B, 0 }, // %LAMBDA -// 0x004D, 0x039C, 0, // %MU -// 0x004E, 0x039D, 0, // %NU - { 0xE0B0, 0x039E, 0 }, // %XI -// 0x004F, 0x039F, 0, // %OMICRON - { 0xE0B1, 0x03A0, 0 }, // %PI -// 0x0050, 0x03A1, 0, // %RHO - { 0xE0B2, 0x03A3, 0 }, // %SIGMA -// 0x0054, 0x03A4, 0, // %TAU - { 0xE0B3, 0x03A5, 0 }, // %UPSILON - { 0xE0B4, 0x03A6, 0 }, // %PHI -// 0x0058, 0x03A7, 0, // %CHI - { 0xE0B5, 0x03A8, 0 }, // %PSI - { 0xE0B6, 0x03A9, 0 }, // %OMEGA - - { 0xE0B7, 0x03B1, 0 }, // %alpha - { 0xE0B8, 0x03B2, 0 }, // %beta - { 0xE0B9, 0x03B3, 0 }, // %gamma - { 0xE0BA, 0x03B4, 0 }, // %delta - { 0xE0BB, 0x03B5, 0 }, // %epsilon - { 0xE0BC, 0x03B6, 0 }, // %zeta - { 0xE0BD, 0x03B7, 0 }, // %eta - { 0xE0BE, 0x03B8, 0 }, // %theta - { 0xE0BF, 0x03B9, 0 }, // %iota - { 0xE0C0, 0x03BA, 0 }, // %kappa - { 0xE0C1, 0x03BB, 0 }, // %lambda - { 0xE0C2, 0x03BC, 0 }, // %mu - { 0xE0C3, 0x03BD, 0 }, // %nu - { 0xE0C4, 0x03BE, 0 }, // %xi - { 0xE0C5, 0x03BF, 0 }, // %omicron - { 0xE0C6, 0x03C0, 0 }, // %pi - { 0xE0C7, 0x03C1, 0 }, // %rho - { 0xE0C8, 0x03C3, 0 }, // %sigma - { 0xE0C9, 0x03C4, 0 }, // %tau - { 0xE0CA, 0x03C5, 0 }, // %upsilon - { 0xE0CB, 0x03C6, 0 }, // %phi - { 0xE0CC, 0x03C7, 0 }, // %chi - { 0xE0CD, 0x03C8, 0 }, // %psi - { 0xE0CE, 0x03C9, 0 }, // %omega - - { 0xE0CF, 0x025B, 0,/*x03B5*/}, // %varepsilon - { 0xE0D0, 0x03D1, 0 }, // %vartheta - { 0xE0D4, 0x03D5, 0 }, // %varphi - { 0xE0D1, 0x03D6, 0 }, // %varpi -// 0x03F1, 0x03F1, 0/*x03C1*/, // %varrho - { 0xE0D3, 0x03C2, 0 }, // %varsigma - -// 0x2227, 0x2227, 0, // %and -// 0x2228, 0x2228, 0, // %or -// 0x2208, 0x2208, 0, // %element -// 0x2209, 0x2209, 0, // %noelement -// 0x226B, 0x226B, 0, // %strictlygreaterthan -// 0x226A, 0x226A, 0, // %strictlylessthan -// 0x2261, 0x2261, 0, // %identical -// 0x221E, 0x221E, 0, // %infinite -// 0x2260, 0x2260, 0, // %notequal - { 0xE080, 0x2030, 0 }, // %perthousand -// 0x2222, 0x2222, 0, // %angle - { 0xE08C, 0x2192, 0 } // %tendto -}; - - -static int nMathToUnicodeLen = sizeof(aMathConvTbl) / sizeof(aMathConvTbl[0]); - sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar ) { - sal_Unicode cRes = 0; + sal_Unicode cRes = cChar; if (IsInPrivateUseArea( cChar )) { - for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i) - { - if (aMathConvTbl[i].cMath == cChar) - cRes = aMathConvTbl[i].cUnicode; - } - } - return cRes; -} - -#ifdef TL_NOT_YET_USED -sal_Unicode ConvertUnicodeToMathPrivateUseArea( sal_Unicode cChar ) -{ - sal_Unicode cRes = 0; - for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i) - { - if (aMathConvTbl[i].cUnicode == cChar) - cRes = aMathConvTbl[i].cMath; - } - return cRes; -} - - -sal_Unicode ConvertMathToMathType( sal_Unicode cChar ) -{ - sal_Unicode cRes = 0; - for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i) - { - const MathConversionEntry &rEntry = aMathConvTbl[i]; - if (rEntry.cMath == cChar) - { - cRes = rEntry.cMathType; - if (cRes == 0) - cRes = rEntry.cUnicode; - } + DBG_ASSERT( 0, "Error: private use area characters should no longer be in use!" ); + cRes = '§'; // just some character that should easily be notice as odd in the context } return cRes; } -sal_Unicode ConvertMathTypeToMath( sal_Unicode cChar ) -{ - sal_Unicode cRes = 0; - for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i) - { - const MathConversionEntry &rEntry = aMathConvTbl[i]; - sal_Unicode cTmp = rEntry.cMathType; - if (cTmp == 0) - cTmp = rEntry.cUnicode; - if (cTmp == cChar) - cRes = rEntry.cMath; - } - return cRes; -} -#endif //TL_NOT_YET_USED sal_Unicode ConvertMathToMathML( sal_Unicode cChar ) { - sal_Unicode cRes = 0; - if (cChar == MS_OVERBRACE) - cRes = 0xF612; // Math-ML code-point (there is no official unicode-point) - else if (cChar == MS_UNDERBRACE) - cRes = 0xF613; // Math-ML code-point (there is no official unicode-point) - else - cRes = ConvertMathPrivateUseAreaToUnicode( cChar ); - return cRes; -} - -#ifdef TL_NOT_YET_USED -sal_Unicode ConvertMathMLToMath( sal_Unicode cChar ) -{ - sal_Unicode cRes = 0; - if (cChar == 0xF612) - cRes = MS_OVERBRACE; // Math-ML code-point (there is no official unicode-point) - else if (cChar == 0xF613) - cRes = MS_UNDERBRACE; // Math-ML code-point (there is no official unicode-point) - else - cRes = ConvertUnicodeToMathPrivateUseArea( cChar ); + sal_Unicode cRes = ConvertMathPrivateUseAreaToUnicode( cChar ); return cRes; } - -sal_Unicode GetTokenChar( sal_Unicode cChar, sal_Bool bConvertForExport ) -{ - sal_Unicode cRes = cChar; - if (bConvertForExport) - { - sal_Unicode cTmp = ConvertMathPrivateUseAreaToUnicode( cChar ); - if (cTmp != 0) - cRes = cTmp; - } - return cRes; -} -#endif //TL_NOT_YET_USED - - -- cgit v1.2.3 From a56e1b52f6781f2de4657c550a2f7f19cadf5b06 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 13 Nov 2009 09:29:22 +0100 Subject: tl76: #i106815#: Math related changes because of the new OpenSymbol font --- starmath/source/types.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starmath/source/types.cxx b/starmath/source/types.cxx index c86b4164928f..9f02e27876b6 100644 --- a/starmath/source/types.cxx +++ b/starmath/source/types.cxx @@ -41,7 +41,7 @@ sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar ) if (IsInPrivateUseArea( cChar )) { DBG_ASSERT( 0, "Error: private use area characters should no longer be in use!" ); - cRes = '§'; // just some character that should easily be notice as odd in the context + cRes = (sal_Unicode) '&'; // just some character that should easily be notice as odd in the context } return cRes; } -- cgit v1.2.3 From 5847cb59f3e70fa0cc800ce2f5e5eb7ded7b671c Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 13 Nov 2009 11:04:06 +0100 Subject: sb116: #i106845# removed obsolete IRIX port --- sw/source/ui/chrdlg/ccoll.cxx | 8 -------- sw/util/makefile.mk | 4 ---- 2 files changed, 12 deletions(-) diff --git a/sw/source/ui/chrdlg/ccoll.cxx b/sw/source/ui/chrdlg/ccoll.cxx index 25276c2cc4bc..e0e4826a93d4 100644 --- a/sw/source/ui/chrdlg/ccoll.cxx +++ b/sw/source/ui/chrdlg/ccoll.cxx @@ -209,11 +209,7 @@ int SwCondCollItem::operator==( const SfxPoolItem& rItem) const const String& SwCondCollItem::GetStyle(USHORT nPos) const { -#ifndef IRIX return nPos < COND_COMMAND_COUNT ? sStyles[nPos] : aEmptyStr; -#else - return nPos < COND_COMMAND_COUNT ? (String)sStyles[nPos] : aEmptyStr; -#endif } /**************************************************************************** @@ -224,11 +220,7 @@ const String& SwCondCollItem::GetStyle(USHORT nPos) const void SwCondCollItem::SetStyle(const String* pStyle, USHORT nPos) { if( nPos < COND_COMMAND_COUNT ) -#ifndef IRIX sStyles[nPos] = pStyle ? *pStyle : aEmptyStr; -#else - sStyles[nPos] = pStyle ? (String)*pStyle : aEmptyStr; -#endif } diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 4b3abf042b8e..ca81fa868510 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -43,10 +43,6 @@ USE_DEFFILE=TRUE # --- Allgemein ----------------------------------------------------------- -.IF "$(OS)"=="IRIX" -LINKFLAGS+=-Wl,-LD_LAYOUT:lgot_buffer=40 -.ENDIF - sw_res_files= \ $(SRS)$/app.srs \ $(SRS)$/dialog.srs \ -- cgit v1.2.3 From 447d6bfd0f3d7680ecd0bbf4568e2e76ae915604 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 18 Nov 2009 19:19:29 +0100 Subject: printerpullpages: #i106507# remove layout page for math --- starmath/source/unomodel.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 0e37f853c164..2527ddb41b81 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -96,7 +96,7 @@ SmPrintUIOptions::SmPrintUIOptions() // create sequence of print UI options // (Actually IsIgnoreSpacesRight is a parser option. Without it we need only 8 properties here.) - m_aUIProperties.realloc( 8 ); + m_aUIProperties.realloc( 9 ); // create Section for formula (results in an extra tab page in dialog) SvtModuleOptions aOpt; @@ -152,6 +152,11 @@ SmPrintUIOptions::SmPrintUIOptions() 10, // min value 1000, // max value aRangeOpt ); + + Sequence< PropertyValue > aHintNoLayoutPage( 1 ); + aHintNoLayoutPage[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HintNoLayoutPage" ) ); + aHintNoLayoutPage[0].Value = makeAny( sal_True ); + m_aUIProperties[8].Value <<= aHintNoLayoutPage; // IsIgnoreSpacesRight is a parser option! Thus we don't add it to the printer UI. // -- cgit v1.2.3 From 1b9308fe40e222d3a2262c7c0e399e8c6aa6ffde Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 18 Nov 2009 20:23:30 +0100 Subject: printerpullpages: #i106505# brochure RTL only if CTL is enabled --- sw/source/core/view/vprint.cxx | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ec58b1dc7927..92838db105ee 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -55,6 +55,7 @@ #include #include +#include #include #include @@ -373,17 +374,22 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : return; } + // check if CTL is enabled + SvtLanguageOptions aLangOpt; + bool bCTL = aLangOpt.IsCTLFontEnabled(); + // create sequence of print UI options // (5 options are not available for Writer-Web) - const int nNumProps = bWeb? 17 : 21; + const int nCTLOpts = bCTL ? 1 : 0; + const int nNumProps = nCTLOpts + (bWeb ? 16 : 20); m_aUIProperties.realloc( nNumProps ); int nIdx = 0; // create "writer" section (new tab page in dialog) - SvtModuleOptions aOpt; + SvtModuleOptions aModOpt; String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), - aOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); + aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); // create sub section for Contents @@ -540,18 +546,21 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : aPageSetOpt ); - // create a bool option for brochure RTL dependent on brochure - uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); - aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); - aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); - vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); - aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), - uno::Sequence< rtl::OUString >(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), - aBRTLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), - aBrochureRTLOpt - ); + if( bCTL ) + { + // create a bool option for brochure RTL dependent on brochure + uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); + aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); + aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); + vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); + aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), + uno::Sequence< rtl::OUString >(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), + aBRTLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aBrochureRTLOpt + ); + } DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); -- cgit v1.2.3 From 0b7a663872f6377fced80cdd6368174f1f28eddb Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 3 Dec 2009 15:25:10 +0100 Subject: #i106926# printing of hidden text fixed --- sw/inc/printdata.hxx | 2 +- sw/inc/unotxdoc.hxx | 19 ++++-- sw/inc/viewopt.hxx | 9 ++- sw/source/core/fields/docufld.cxx | 3 +- sw/source/core/text/itrform2.cxx | 5 +- sw/source/core/view/vprint.cxx | 4 +- sw/source/ui/uno/unotxdoc.cxx | 123 ++++++++++++++++++++++++-------------- 7 files changed, 107 insertions(+), 58 deletions(-) mode change 100644 => 100755 sw/inc/printdata.hxx mode change 100644 => 100755 sw/inc/unotxdoc.hxx mode change 100644 => 100755 sw/inc/viewopt.hxx mode change 100644 => 100755 sw/source/core/view/vprint.cxx mode change 100644 => 100755 sw/source/ui/uno/unotxdoc.cxx diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx old mode 100644 new mode 100755 index 1d7841953edc..2df487f69838 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -121,7 +121,7 @@ public: void DeletePostItData(); bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != 0; } - void ViewOptionAdjustStart( SwWrtShell& rSh ); + void ViewOptionAdjustStart( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ); void ViewOptionAdjustStop(); bool HasSwPrtOptions() const { return m_pPrtOptions != 0; } diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx old mode 100644 new mode 100755 index bea720e592bf..a5c39b2d928d --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -591,21 +591,28 @@ public: /*-- 06.01.2004 15:08:34--------------------------------------------------- The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of the current ViewShell so that fields are not printed as commands and - hidden text and hidden characters are always invisible. + hidden characters are always invisible. Hidden text and place holders + should be printed according to the current print options. After printing the view options are restored -----------------------------------------------------------------------*/ class SwViewOptionAdjust_Impl { + // options not available in the File/Print UI, should be turned off for + // printing and PDF export if they are enabled bool m_bSwitchOff_IsFldName; - bool m_bSwitchOff_PlaceHolderView; - bool m_bSwitchOff_HiddenChar; - bool m_bSwitchOff_HiddenParagraphs; - bool m_bSwitchOff_IsShowHiddenField; + + // options available in the File/Print UI, should be turned of for PDF export + // and otherwise set (or not) according to + // pPrtOptions->bPrintHiddenText and pPrtOptions->bPrintTextPlaceholder + bool m_bToggle_HiddenChar; + bool m_bToggle_HiddenField; + bool m_bToggle_HiddenParagraphs; + bool m_bToggle_PlaceHolderView; SwViewOption* m_pViewOption; SwWrtShell& m_rShell; public: - SwViewOptionAdjust_Impl(SwWrtShell& rSh); + SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ); ~SwViewOptionAdjust_Impl(); }; diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx old mode 100644 new mode 100755 index d650d90cf08e..2ac47e284b49 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -82,8 +82,7 @@ namespace svtools{ class ColorConfig;} #define VIEWOPT_CORE2_SMOOTHSCROLL 0x00000004L #define VIEWOPT_CORE2_CRSR_IN_PROT 0x00000008L #define VIEWOPT_CORE2_PDF_EXPORT 0x00000010L - - +#define VIEWOPT_CORE2_PRINTING 0x00000020L #define VIEWOPT_CORE2_BIGMARKHDL 0x00000040L #define VIEWOPT_2_UNUSED1 0x00000100L @@ -381,6 +380,12 @@ public: inline void SetPDFExport(BOOL b) { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_PDF_EXPORT) : (nCore2Options &= ~VIEWOPT_CORE2_PDF_EXPORT);} + inline BOOL IsPrinting() const + {return nCore2Options & VIEWOPT_CORE2_PRINTING ? TRUE : FALSE;} + + inline void SetPrinting(BOOL b) + { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_PRINTING) : (nCore2Options &= ~VIEWOPT_CORE2_PRINTING);} + /*--------------------------------------------------------------------------- ----------------------------------------------------------------------------*/ diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 6bb8ff4902ea..6d451ed01f41 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1335,7 +1335,8 @@ BOOL SwDocInfoField::PutValue( const uno::Any& rAny, USHORT nWhichId ) SwHiddenTxtFieldType::SwHiddenTxtFieldType( sal_Bool bSetHidden ) : SwFieldType( RES_HIDDENTXTFLD ), bHidden( bSetHidden ) -{} +{ +} SwFieldType* SwHiddenTxtFieldType::Copy() const { diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index cb54872d19e2..ab15998f86aa 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2106,7 +2106,10 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd, bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos ) { // Only if hidden text should not be shown: - if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() ) +// if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() ) + const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar(); + const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( TRUE ) && rInf.GetOpt().IsPrinting(); + if (bShowInDocView || bShowForPrinting) return false; const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo(); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx old mode 100644 new mode 100755 index 92838db105ee..715c74870f2f --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -282,11 +282,11 @@ void SwRenderData::DeletePostItData() } -void SwRenderData::ViewOptionAdjustStart( SwWrtShell& rSh ) +void SwRenderData::ViewOptionAdjustStart( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ) { if (m_pViewOptionAdjust) delete m_pViewOptionAdjust; - m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh ); + m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, pPrtOptions ); } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx old mode 100644 new mode 100755 index 2e0ecf2eb155..51fdb6779778 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2653,6 +2653,11 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( pWrtShell = pSwView->GetWrtShellPtr(); } + // reformating the document for printing will show the changes in the view + // which is likely to produce many unwanted and not nice to view actions. + // We don't want that! Thus we disable updating of the view. + pWrtShell->StartAction(); + m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); @@ -2660,7 +2665,11 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); const TypeId aSwViewTypeId = TYPE(SwView); if (pView->IsA(aSwViewTypeId)) - m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr() ); + { + // PDF export should not make use of the SwPrtOptions + const SwPrtOptions *pPrtOptions = bIsPDFExport? NULL : m_pRenderData->GetSwPrtOptions(); + m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr(), pPrtOptions ); + } // since printing now also use the API for PDF export this option // should be set for printing as well ... @@ -2677,6 +2686,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( pWrtShell->CalcPagesForPrint( pDoc->GetPageCount() ); pWrtShell->SetPDFExportOption( sal_False ); + + + // enable view again + pWrtShell->EndAction(); } const sal_Int32 nPageCount = pDoc->GetPageCount(); @@ -3985,52 +3998,69 @@ void SwXDocumentPropertyHelper::onChange() /*****************************************************************************/ -SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl(SwWrtShell& rSh) : +SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ) : m_pViewOption(0), m_rShell(rSh) { const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions(); - m_bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && m_rShell.IsAnyFieldInDoc(); + + const bool bContainsHiddenChars = m_rShell.GetDoc()->ContainsHiddenChars(); + const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENTXTFLD ); + const bool bContainsHiddenFields = pFldType && pFldType->GetDepends(); + pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENPARAFLD ); + const bool bContainsHiddenParagraphs = pFldType && pFldType->GetDepends(); + pFldType = m_rShell.GetDoc()->GetSysFldType( RES_JUMPEDITFLD ); + const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends(); + + m_bSwitchOff_IsFldName = m_rShell.IsAnyFieldInDoc() && pCurrentViewOptions->IsFldName(); + + // for printing only (not PDF export) take print options into account + if (pPrtOptions) + { + m_bToggle_PlaceHolderView = bContainsPlaceHolders && pPrtOptions->bPrintTextPlaceholder != pCurrentViewOptions->IsShowPlaceHolderFields(); + m_bToggle_HiddenChar = bContainsHiddenChars && pPrtOptions->bPrintHiddenText != pCurrentViewOptions->IsShowHiddenChar( TRUE ); + m_bToggle_HiddenField = bContainsHiddenFields && pPrtOptions->bPrintHiddenText != pCurrentViewOptions->IsShowHiddenField(); + m_bToggle_HiddenParagraphs = bContainsHiddenParagraphs && pPrtOptions->bPrintHiddenText != pCurrentViewOptions->IsShowHiddenPara(); + } + else + { + //toggle painting of placeholder fields + m_bToggle_PlaceHolderView = bContainsPlaceHolders && pCurrentViewOptions->IsShowPlaceHolderFields(); + //toggle display of hidden characters if on and hidden characters are in use + m_bToggle_HiddenChar = bContainsHiddenChars && pCurrentViewOptions->IsShowHiddenChar( FALSE ); + //toggle display of hidden fields if on and hidden fields are in use + m_bToggle_HiddenField = bContainsHiddenFields && pCurrentViewOptions->IsShowHiddenField(); + //toggle display of hidden paragraphs if on and hidden paragraphs are in use + m_bToggle_HiddenParagraphs = bContainsHiddenParagraphs && pCurrentViewOptions->IsShowHiddenPara(); + } + + // bApplyViewOptions should only be true if necessary to avoid reformating if not required, bool bApplyViewOptions = m_bSwitchOff_IsFldName; - //switch off painting of placeholder fields - m_bSwitchOff_PlaceHolderView = pCurrentViewOptions->IsShowPlaceHolderFields(); - //switch off display of hidden characters if on and hidden characters are in use - m_bSwitchOff_HiddenChar = pCurrentViewOptions->IsShowHiddenChar() && m_rShell.GetDoc()->ContainsHiddenChars(); - //switch off display of hidden paragraphs if on and hidden paragraphs are in use - m_bSwitchOff_HiddenParagraphs = pCurrentViewOptions->IsShowHiddenPara(); - if(m_bSwitchOff_HiddenParagraphs) - { - const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENPARAFLD); - if(!pFldType || !pFldType->GetDepends()) - m_bSwitchOff_HiddenParagraphs = false; - } - m_bSwitchOff_IsShowHiddenField = pCurrentViewOptions->IsShowHiddenField(); - if(m_bSwitchOff_IsShowHiddenField) - { - const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType(RES_HIDDENTXTFLD); - if( !pFldType || !pFldType->GetDepends()) - m_bSwitchOff_IsShowHiddenField = false; - } - - bApplyViewOptions |= m_bSwitchOff_PlaceHolderView; - bApplyViewOptions |= m_bSwitchOff_HiddenChar; - bApplyViewOptions |= m_bSwitchOff_HiddenParagraphs; - bApplyViewOptions |= m_bSwitchOff_IsShowHiddenField; + bApplyViewOptions |= m_bToggle_PlaceHolderView; + bApplyViewOptions |= m_bToggle_HiddenChar; + bApplyViewOptions |= m_bToggle_HiddenField; + bApplyViewOptions |= m_bToggle_HiddenParagraphs; if(bApplyViewOptions) { - m_pViewOption = new SwViewOption(*m_rShell.GetViewOptions()); + m_pViewOption = new SwViewOption( *pCurrentViewOptions ); + + // set flag to hint that everything should be formatted for printing, + // (needed at some places to print hidden text if that option is set in the dialog, etc.) + m_pViewOption->SetPrinting( TRUE ); + if(m_bSwitchOff_IsFldName) m_pViewOption->SetFldName(FALSE); - if(m_bSwitchOff_PlaceHolderView) - m_pViewOption->SetShowPlaceHolderFields(FALSE); - if(m_bSwitchOff_HiddenChar) - m_pViewOption->SetShowHiddenChar(FALSE); - if(m_bSwitchOff_HiddenParagraphs) - m_pViewOption->SetShowHiddenPara(FALSE); - if(m_bSwitchOff_IsShowHiddenField) - m_pViewOption->SetShowHiddenField(FALSE); + if(m_bToggle_PlaceHolderView) + m_pViewOption->SetShowPlaceHolderFields( !pCurrentViewOptions->IsShowPlaceHolderFields() ); + if(m_bToggle_HiddenChar) + m_pViewOption->SetShowHiddenChar( !pCurrentViewOptions->IsShowHiddenChar( TRUE ) ); + if(m_bToggle_HiddenField) + m_pViewOption->SetShowHiddenField( !pCurrentViewOptions->IsShowHiddenField() ); + if(m_bToggle_HiddenParagraphs) + m_pViewOption->SetShowHiddenPara( !pCurrentViewOptions->IsShowHiddenPara() ); SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); } + } @@ -4038,18 +4068,21 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() { if(m_pViewOption) { + m_pViewOption->SetPrinting( FALSE ); + + const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions(); if(m_bSwitchOff_IsFldName) m_pViewOption->SetFldName(TRUE); - if(m_bSwitchOff_PlaceHolderView) - m_pViewOption->SetShowPlaceHolderFields(TRUE); - if(m_bSwitchOff_HiddenChar) - m_pViewOption->SetShowHiddenChar(TRUE); - if(m_bSwitchOff_HiddenParagraphs) - m_pViewOption->SetShowHiddenPara(TRUE); - if(m_bSwitchOff_IsShowHiddenField) - m_pViewOption->SetShowHiddenField(TRUE); + if(m_bToggle_HiddenChar) + m_pViewOption->SetShowHiddenChar( !pCurrentViewOptions->IsShowHiddenChar() ); + if(m_bToggle_HiddenField) + m_pViewOption->SetShowHiddenField( !pCurrentViewOptions->IsShowHiddenField() ); + if(m_bToggle_HiddenParagraphs) + m_pViewOption->SetShowHiddenPara( !pCurrentViewOptions->IsShowHiddenPara() ); + if(m_bToggle_PlaceHolderView) + m_pViewOption->SetShowPlaceHolderFields( !pCurrentViewOptions->IsShowPlaceHolderFields() ); SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); - delete m_pViewOption; + delete m_pViewOption; m_pViewOption = NULL; } } -- cgit v1.2.3 From ff016bd9d3e87d93db950c60ad7ccb5c31b5fa7a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 3 Dec 2009 17:24:39 +0000 Subject: cmcfixes68: #i107420# remove trivial warnings from sw with newer gcc --- sw/source/core/unocore/unotext.cxx | 4 ++-- sw/source/ui/uiview/srcview.cxx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 7ae4b209f49f..ee1055b276c9 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -270,8 +270,8 @@ void SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange, sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); } - if(pRange && pRange->GetDoc() == GetDoc() || - pCursor && pCursor->GetDoc() == GetDoc()) + if( (pRange && pRange->GetDoc() == GetDoc()) || + (pCursor && pCursor->GetDoc() == GetDoc()) ) { const SwStartNode* pOwnStartNode = GetStartNode(); if(pCursor) diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index d30e85c5ee71..e93abdf73b15 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -717,6 +717,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, if(!bApi) + { if(bNotFoundMessage) { InfoBox( 0, SW_RES(MSG_NOT_FOUND)).Execute(); @@ -728,6 +729,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, pTextView->SetSelection( TextSelection( aPaM, aPaM ) ); StartSearchAndReplace( rSearchItem, FALSE, FALSE, TRUE ); } + } } return nFound; } -- cgit v1.2.3 From 8a75134b7668c04ee8b8bab2d49a84d3540a702a Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 7 Dec 2009 14:11:32 +0100 Subject: #i104312# fixed print objetcs for pictures and graphics; nopw works for drawing objects as well and does not effect form controls --- sw/source/core/doc/notxtfrm.cxx | 2 +- sw/source/core/inc/cellfrm.hxx | 2 +- sw/source/core/inc/flyfrm.hxx | 2 +- sw/source/core/inc/frame.hxx | 3 ++- sw/source/core/inc/layfrm.hxx | 2 +- sw/source/core/inc/notxtfrm.hxx | 2 +- sw/source/core/inc/rootfrm.hxx | 2 +- sw/source/core/inc/tabfrm.hxx | 2 +- sw/source/core/inc/txtfrm.hxx | 2 +- sw/source/core/inc/viewimp.hxx | 10 ++++++---- sw/source/core/layout/paintfrm.cxx | 22 +++++++++++----------- sw/source/core/layout/unusedf.cxx | 2 +- sw/source/core/text/frmpaint.cxx | 2 +- sw/source/core/view/vdraw.cxx | 8 ++++++++ sw/source/core/view/vprint.cxx | 16 +++++++++------- sw/source/ui/config/optdlg.src | 2 +- sw/source/ui/uno/unotxdoc.cxx | 4 +++- 17 files changed, 50 insertions(+), 35 deletions(-) mode change 100644 => 100755 sw/source/ui/config/optdlg.src diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 9f464aac5424..4a8ecf7ff09a 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -269,7 +269,7 @@ void lcl_ClearArea( const SwFrm &rFrm, |* *************************************************************************/ -void SwNoTxtFrm::Paint( const SwRect &rRect ) const +void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) const { if ( Frm().IsEmpty() ) return; diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx index c8bbc7be70c6..0825ccc2dfd7 100644 --- a/sw/source/core/inc/cellfrm.hxx +++ b/sw/source/core/inc/cellfrm.hxx @@ -51,7 +51,7 @@ public: virtual BOOL GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* = 0 ) const; virtual void Modify( SfxPoolItem*, SfxPoolItem* ); - virtual void Paint( const SwRect& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; virtual void CheckDirection( BOOL bVert ); const SwTableBox *GetTabBox() const { return pTabBox; } diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index dc8975f3fd47..031b93e7ce21 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -161,7 +161,7 @@ public: virtual void Modify( SfxPoolItem*, SfxPoolItem* ); // erfrage vom Client Informationen virtual BOOL GetInfo( SfxPoolItem& ) const; - virtual void Paint( const SwRect& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; virtual Size ChgSize( const Size& aNewSize ); virtual BOOL GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* = 0 ) const; diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 02c8040b83c3..1fe6e00af3e5 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -56,6 +56,7 @@ class SvxBrushItem; class SwSelectionList; struct SwPosition; struct SwCrsrMoveState; +class SwPrtOptions; // --> OD 2004-07-06 #i28701# class SwSortedObjs; @@ -828,7 +829,7 @@ public: SwCrsrMoveState* = 0 ) const; virtual BOOL GetCharRect( SwRect &, const SwPosition&, SwCrsrMoveState* = 0 ) const; - virtual void Paint( const SwRect& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; // der "kurze Dienstweg" zwischen den Frames und der Formatierung. // Wer den void* falsch Casted ist selbst schuld! diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 76262d18a894..e3ee5edf60c1 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -108,7 +108,7 @@ public: SwLayoutFrm( SwFrmFmt* ); ~SwLayoutFrm(); - virtual void Paint( const SwRect& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; const SwFrm *Lower() const { return pLower; } SwFrm *Lower() { return pLower; } const SwCntntFrm *ContainsCntnt() const; diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx index 81d63e733f9c..ff739b530758 100644 --- a/sw/source/core/inc/notxtfrm.hxx +++ b/sw/source/core/inc/notxtfrm.hxx @@ -59,7 +59,7 @@ public: ~SwNoTxtFrm(); virtual void Modify( SfxPoolItem*, SfxPoolItem* ); - virtual void Paint(const SwRect& ) const; + virtual void Paint(const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; virtual BOOL GetCharRect( SwRect &, const SwPosition&, SwCrsrMoveState* = 0) const; BOOL GetCrsrOfst(SwPosition* pPos, Point& aPoint, diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index c04b30792b53..7e9b0eeb61d9 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -200,7 +200,7 @@ public: virtual BOOL GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* = 0 ) const; - virtual void Paint( const SwRect& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); #ifndef PRODUCT diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx index b41ba4214aa0..bbd2931d7839 100644 --- a/sw/source/core/inc/tabfrm.hxx +++ b/sw/source/core/inc/tabfrm.hxx @@ -132,7 +132,7 @@ public: virtual void Modify( SfxPoolItem*, SfxPoolItem* ); virtual BOOL GetInfo( SfxPoolItem &rHnt ) const; - virtual void Paint( const SwRect& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; virtual void CheckDirection( BOOL bVert ); virtual void Cut(); diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index b0b2b807ab43..bdfdf3efde74 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -296,7 +296,7 @@ public: void PaintExtraData( const SwRect & rRect ) const; //Seitennummer usw. SwRect Paint(); - virtual void Paint( const SwRect & ) const; + virtual void Paint( const SwRect &, const SwPrtOptions *pPrintData = NULL ) const; virtual void Modify( SfxPoolItem*, SfxPoolItem* ); virtual sal_Bool GetInfo( SfxPoolItem & ) const; diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index eba323bd52a2..026b293a827c 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -57,6 +57,7 @@ struct SdrPaintProcRec; class SwAccessibleMap; class SdrObject; class Fraction; +class SwPrtOptions; // OD 12.12.2002 #103492# class SwPagePreviewLayout; // OD 15.01.2003 #103492# @@ -270,10 +271,11 @@ public: // direction at the outliner of the draw view for painting layers // and . // OD 25.06.2003 #108784# - correct type of 1st parameter - void PaintLayer ( const SdrLayerID _nLayerID, - const SwRect& _rRect, - const Color* _pPageBackgrdColor = 0, - const bool _bIsPageRightToLeft = false ) const; + void PaintLayer( const SdrLayerID _nLayerID, + const SwPrtOptions *pPrintData, + const SwRect& _rRect, + const Color* _pPageBackgrdColor = 0, + const bool _bIsPageRightToLeft = false ) const; //wird als Link an die DrawEngine uebergeben, entscheidet was wie //gepaintet wird oder nicht. diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 7dcbc4ef80a9..6181269b96b8 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2740,7 +2740,7 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) |* |*************************************************************************/ -void SwRootFrm::Paint( const SwRect& rRect ) const +void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const { ASSERT( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); @@ -2939,7 +2939,7 @@ void SwRootFrm::Paint( const SwRect& rRect ) const // OD 29.08.2002 #102450# - add 3rd parameter // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), aPaintRect, + pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), pPrintData, aPaintRect, &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false) ); pLines->PaintLines( pSh->GetOut() ); pLines->LockLines( FALSE ); @@ -2972,7 +2972,7 @@ void SwRootFrm::Paint( const SwRect& rRect ) const { /// OD 29.08.2002 #102450# - add 3rd parameter // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. - pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(), aPaintRect, + pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(), pPrintData, aPaintRect, &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false) ); } @@ -3190,7 +3190,7 @@ SwShortCut::SwShortCut( const SwFrm& rFrm, const SwRect& rRect ) } } -void SwLayoutFrm::Paint( const SwRect& rRect ) const +void SwLayoutFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const { ViewShell *pSh = GetShell(); @@ -3478,7 +3478,7 @@ BOOL SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh ) /************************************************************************* |* SwCellFrm::Paint( const SwRect& ) const |*************************************************************************/ -void SwCellFrm::Paint( const SwRect& rRect ) const +void SwCellFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const { if ( GetLayoutRowSpan() >= 1 ) SwLayoutFrm::Paint( rRect ); @@ -3497,7 +3497,7 @@ void SwCellFrm::Paint( const SwRect& rRect ) const void MA_FASTCALL lcl_PaintLowerBorders( const SwLayoutFrm *pLay, const SwRect &rRect, const SwPageFrm *pPage ); -void SwFlyFrm::Paint( const SwRect& rRect ) const +void SwFlyFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const { //wegen der Ueberlappung von Rahmen und Zeichenobjekten muessen die //Flys ihre Umrandung (und die der Innenliegenden) direkt ausgeben. @@ -3732,7 +3732,7 @@ void SwFlyFrm::Paint( const SwRect& rRect ) const |* |*************************************************************************/ -void SwTabFrm::Paint( const SwRect& rRect ) const +void SwTabFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const { if ( pGlobalShell->GetViewOptions()->IsTable() ) { @@ -6438,10 +6438,10 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), + pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), 0, aRetouchePart, &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false) ); - pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), + pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), 0, aRetouchePart, &aPageBackgrdColor, (pPage->IsRightToLeft() ? true : false) ); } @@ -6691,14 +6691,14 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) // OD 30.08.2002 #102450# - add 3rd parameter // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); - pImp->PaintLayer( pIDDMA->GetHellId(), aOut, &aPageBackgrdColor, + pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor, (pFlyPage->IsRightToLeft() ? true : false) ); pLines->PaintLines( &aDev ); if ( pFly->IsFlyInCntFrm() ) pFly->Paint( aOut ); pLines->PaintLines( &aDev ); /// OD 30.08.2002 #102450# - add 3rd parameter - pImp->PaintLayer( pIDDMA->GetHeavenId(), aOut, &aPageBackgrdColor, + pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor, (pFlyPage->IsRightToLeft() ? true : false) ); pLines->PaintLines( &aDev ); DELETEZ( pLines ); diff --git a/sw/source/core/layout/unusedf.cxx b/sw/source/core/layout/unusedf.cxx index e7d602ae5aba..5eb230f0b3ba 100644 --- a/sw/source/core/layout/unusedf.cxx +++ b/sw/source/core/layout/unusedf.cxx @@ -44,7 +44,7 @@ void SwFrm::Format( const SwBorderAttrs * ) ASSERT( FALSE, "Format() der Basisklasse gerufen." ); } -void SwFrm::Paint(const SwRect &) const +void SwFrm::Paint(const SwRect &, const SwPrtOptions * ) const { ASSERT( FALSE, "Paint() der Basisklasse gerufen." ); } diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 5a88599c6e35..1492f1167f38 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -600,7 +600,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const * SwTxtFrm::Paint() *************************************************************************/ -void SwTxtFrm::Paint( const SwRect &rRect ) const +void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) const { ResetRepaint(); diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 7429eb5c444d..b58026e33a72 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -57,6 +57,7 @@ #include "viewimp.hxx" #include "dflyobj.hxx" #include "viewopt.hxx" +#include "swprtopt.hxx" #include "dcontact.hxx" #include "dview.hxx" #include "flyfrm.hxx" @@ -184,6 +185,7 @@ void SwViewImp::UnlockPaint() // outliner of the draw view for painting layers and . // OD 25.06.2003 #108784# - correct type of 1st parameter void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, + const SwPrtOptions * _pPrintData, const SwRect& , const Color* _pPageBackgrdColor, const bool _bIsPageRightToLeft ) const @@ -230,6 +232,12 @@ void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, } pOutDev->Push( PUSH_LINECOLOR ); // #114231# + if (_pPrintData) + { + // hide drawings but not form controls (form controls are handled elsewhere) + SdrView &rSdrView = const_cast< SdrView & >(GetPageView()->GetView()); + rSdrView.setHideDraw( !_pPrintData->IsPrintDraw() ); + } GetPageView()->DrawLayer(_nLayerID, pOutDev); pOutDev->Pop(); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 715c74870f2f..ed23a7b251e6 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -404,7 +404,7 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : // create a bool option for graphics m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTablesGraphicsAndDiagrams" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), sal_True ); if (!bWeb) { @@ -611,9 +611,11 @@ bool SwPrintUIOptions::IsPrintTables() const // take care of different property names for the option. // for compatibility the old name should win - bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); - bRes = getBoolValue( "PrintTables", bRes ); - return bRes; +// bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); +// bRes = getBoolValue( "PrintTables", bRes ); +// return bRes; + // for now it was decided that tables should always be printed + return true; } bool SwPrintUIOptions::IsPrintGraphics() const @@ -621,7 +623,7 @@ bool SwPrintUIOptions::IsPrintGraphics() const // take care of different property names for the option. // for compatibility the old name should win - bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); bRes = getBoolValue( "PrintGraphics", bRes ); return bRes; } @@ -631,7 +633,7 @@ bool SwPrintUIOptions::IsPrintDrawings() const // take care of different property names for the option. // for compatibility the old name should win - bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); + bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); bRes = getBoolValue( "PrintDrawings", bRes ); return bRes; } @@ -1186,7 +1188,7 @@ sal_Bool ViewShell::PrintOrPDFExport( rPrintData.GetRenderData().m_pPostItShell : pShell; ::SetSwVisArea( pViewSh2, pStPage->Frm() ); - pStPage->GetUpper()->Paint( pStPage->Frm() ); + pStPage->GetUpper()->Paint( pStPage->Frm(), &rPrintData ); SwPaintQueue::Repaint(); } //Zus. Scope wg. CurShell! diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src old mode 100644 new mode 100755 index 7c839834234f..ce1d9ae22942 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -944,7 +944,7 @@ StringArray STR_PRINTOPTUI < "Contents"; >; < "Page ba~ckground"; >; < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; - < "~Graphics and diagrams"; >; + < "~Pictures and objects"; >; < "Specifies whether the graphics of your text document are printed"; >; < "Hidden te~xt"; >; < "Enable this option to print text that is marked as hidden."; >; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 51fdb6779778..c7888f754ff0 100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -3998,7 +3998,9 @@ void SwXDocumentPropertyHelper::onChange() /*****************************************************************************/ -SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ) : +SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( + SwWrtShell& rSh, + const SwPrtOptions *pPrtOptions ) : m_pViewOption(0), m_rShell(rSh) { -- cgit v1.2.3 From 34b5a53a562ac9bb3387e1e5603cd04165a268ae Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Dec 2009 13:00:42 +0100 Subject: #i105728#, #i105730#, #i105727# intelli UI thingies --- sw/inc/docsh.hxx | 1 + sw/inc/printdata.hxx | 3 ++- sw/inc/viewsh.hxx | 2 +- sw/source/core/doc/doc.cxx | 22 +++++++++++++---- sw/source/core/view/viewpg.cxx | 30 +++-------------------- sw/source/core/view/vprint.cxx | 55 ++++++++++++------------------------------ sw/source/ui/inc/srcview.hxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 38 +++++++++++++++++++---------- 8 files changed, 65 insertions(+), 88 deletions(-) mode change 100644 => 100755 sw/inc/docsh.hxx mode change 100644 => 100755 sw/inc/viewsh.hxx mode change 100644 => 100755 sw/source/core/view/viewpg.cxx mode change 100644 => 100755 sw/source/ui/inc/srcview.hxx diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx old mode 100644 new mode 100755 index 6ed3f6d652bd..df06af8a8a36 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -183,6 +183,7 @@ public: // Doc rausreichen aber VORSICHT inline SwDoc* GetDoc() { return pDoc; } + inline const SwDoc* GetDoc() const { return pDoc; } IDocumentDeviceAccess* getIDocumentDeviceAccess(); const IDocumentSettingAccess* getIDocumentSettingAccess() const; IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess(); diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 2df487f69838..356ecb30b79e 100755 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -50,6 +50,7 @@ class OutputDevice; class SwViewOptionAdjust_Impl; class SwPrtOptions; class SwWrtShell; +class SfxViewShell; //////////////////////////////////////////////////////////// @@ -60,7 +61,7 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper OutputDevice* m_pLast; public: - SwPrintUIOptions( bool bWeb, bool bSwSrcView ); + SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts ); ~SwPrintUIOptions(); bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx old mode 100644 new mode 100755 index 03d1c9d64184..30624f23c2ef --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -387,7 +387,7 @@ public: SwDoc * FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt ); //Wird intern fuer die Shell gerufen die Druckt. Formatiert die Seiten. - void CalcPagesForPrint( sal_uInt16 nMax, SfxProgress* pProgress = 0 ); + void CalcPagesForPrint( sal_uInt16 nMax ); //All about fields. void UpdateFlds(sal_Bool bCloseDB = sal_False); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index e2b94926380b..89323951c7e2 100755 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1078,10 +1078,12 @@ USHORT _PostItFld::GetPageNo( } -void lcl_GetPostIts( +bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, - _SetGetExpFlds& rSrtLst ) + _SetGetExpFlds * pSrtLst ) { + bool bHasPostIts = false; + SwFieldType* pFldType = pIDFA->GetSysFldType( RES_POSTITFLD ); DBG_ASSERT( pFldType, "kein PostItType ? "); @@ -1093,14 +1095,24 @@ void lcl_GetPostIts( const SwTxtFld* pTxtFld; for( pLast = aIter.First( TYPE(SwFmtFld)); pLast; pLast = aIter.Next() ) + { if( 0 != ( pTxtFld = ((SwFmtFld*)pLast)->GetTxtFld() ) && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) { - SwNodeIndex aIdx( pTxtFld->GetTxtNode() ); - _PostItFld* pNew = new _PostItFld( aIdx, pTxtFld ); - rSrtLst.Insert( pNew ); + bHasPostIts = true; + if (pSrtLst) + { + SwNodeIndex aIdx( pTxtFld->GetTxtNode() ); + _PostItFld* pNew = new _PostItFld( aIdx, pTxtFld ); + pSrtLst->Insert( pNew ); + } + else + break; // we just wanted to check for the existence of postits ... } + } } + + return bHasPostIts; } diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx old mode 100644 new mode 100755 index 379f8b42d0c5..61594065c3db --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -131,25 +131,7 @@ void ViewShell::PrintProspect( aShell.PrepareForPrint( rPrintData ); -#if 0 // applying view options and formatting the dcoument should now only be done in getRendererCount! - // gibt es versteckte Absatzfelder, unnoetig wenn die Absaetze bereits - // ausgeblendet sind. - int bHiddenFlds = FALSE; - SwFieldType* pFldType = 0; - if ( GetViewOptions()->IsShowHiddenPara() ) - { - pFldType = getIDocumentFieldsAccess()->GetSysFldType( RES_HIDDENPARAFLD ); - bHiddenFlds = 0 != pFldType->GetDepends(); - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - } - } - - // Seiten fuers Drucken formatieren - aShell.CalcPagesForPrint( nPageMax, 0 ); -#endif + //!! applying view options and formatting the dcoument should now only be done in getRendererCount! MapMode aMapMode( MAP_TWIP ); Size aPrtSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), aMapMode ) ); @@ -271,14 +253,8 @@ void ViewShell::PrintProspect( SwPaintQueue::Repaint(); -#if 0 // applying view options and formatting the dcoument should now only be done in getRendererCount! - if( bHiddenFlds ) - { - SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT ); - pFldType->Modify( &aHnt, 0); - CalcPagesForPrint( nPageMax ); - } -#endif + //!! applying/modifying view options and formatting the dcoument should now only be done in getRendererCount! + pFntCache->Flush(); // restore settings of OutputDevice (should be done always now since the diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ed23a7b251e6..66aa3741148f 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -102,7 +102,7 @@ #define JOBSET_ERR_ISSTARTET 2 -extern void lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds& rSrtLst ); +extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst ); using namespace ::com::sun::star; @@ -255,7 +255,7 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, { DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" ); m_pPostItFields = new _SetGetExpFlds; - lcl_GetPostIts( pDoc, *m_pPostItFields ); + lcl_GetPostIts( pDoc, m_pPostItFields ); m_pPostItDoc = new SwDoc; //!! Disable spell and grammar checking in the temporary document. @@ -357,7 +357,7 @@ void SwRenderData::MakeSwPrtOptions( /*****************************************************************************/ -SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : +SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts ) : m_pLast( NULL ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -466,19 +466,22 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : // create a choice for the content to create rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); - uno::Sequence< rtl::OUString > aChoices( 3 ); - uno::Sequence< rtl::OUString > aHelpText( 3 ); + uno::Sequence< rtl::OUString > aChoices( bHasSelection ? 3 : 2 ); + uno::Sequence< rtl::OUString > aHelpText( bHasSelection ? 3 : 2 ); aChoices[0] = aLocalizedStrings.GetString( 38 ); aHelpText[0] = aLocalizedStrings.GetString( 39 ); aChoices[1] = aLocalizedStrings.GetString( 40 ); aHelpText[1] = aLocalizedStrings.GetString( 41 ); - aChoices[2] = aLocalizedStrings.GetString( 42 ); - aHelpText[2] = aLocalizedStrings.GetString( 43 ); + if (bHasSelection) + { + aChoices[2] = aLocalizedStrings.GetString( 42 ); + aHelpText[2] = aLocalizedStrings.GetString( 43 ); + } m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), aHelpText, aPrintRangeName, aChoices, - 0 ); + bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */); // create a an Edit dependent on "Pages" selected vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), @@ -504,6 +507,7 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView ) : aHelpText[0] = aLocalizedStrings.GetString( 25 ); aHelpText[1] = aLocalizedStrings.GetString( 25 ); vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False ); + aAnnotOpt.mbEnabled = bHasPostIts; m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), @@ -830,16 +834,10 @@ void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax, -void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress ) +void ViewShell::CalcPagesForPrint( USHORT nMax ) { SET_CURR_SHELL( this ); - //Seitenweise durchformatieren, by the way kann die Statusleiste - //angetriggert werden, damit der Anwender sieht worauf er wartet. - //Damit der Vorgang moeglichst transparent gestaltet werden kann - //Versuchen wir mal eine Schaetzung. - SfxPrinter* pPrt = getIDocumentDeviceAccess()->getPrinter( false ); - BOOL bPrtJob = pPrt ? pPrt->IsJobActive() : FALSE; SwRootFrm* pLayout = GetLayout(); // ULONG nStatMax = pLayout->GetPageNum(); @@ -849,12 +847,6 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress ) pLayout->StartAllAction(); for ( USHORT i = 1; pPage && i <= nMax; pPage = pPage->GetNext(), ++i ) { - if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) - break; - - if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) - break; - pPage->Calc(); SwRect aOldVis( VisArea() ); aVisArea = pPage->Frm(); @@ -868,12 +860,8 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress ) aVisArea = aOldVis; //Zuruecksetzen wg. der Paints! Imp()->SetFirstVisPageInvalid(); - SwPaintQueue::Repaint(); +// SwPaintQueue::Repaint(); } - - if (pProgress) - aAction.SetProgress( NULL ); - pLayout->EndAllAction(); } @@ -1153,20 +1141,7 @@ sal_Bool ViewShell::PrintOrPDFExport( } DBG_ASSERT( pStPage, "failed to get start page" ); -#if 0 // applying view options and formatting the dcoument should now only be done in getRendererCount! - // benoetigte Seiten fuers Drucken formatieren - pShell->CalcPagesForPrint( (USHORT)nPage, 0 ); - - // Some field types, can require a valid layout - // (expression fields in tables). For these we do an UpdateFlds - // here after calculation of the pages. - // --> FME 2004-06-21 #i9684# For performance reasons, we do not update - // the fields during pdf export. - // #i56195# prevent update of fields (for mail merge) - if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) - pShell->UpdateFlds(TRUE); - // <-- -#endif + //!! applying view options and formatting the dcoument should now only be done in getRendererCount! ViewShell *pViewSh2 = nPage == 0 ? /* post-it page? */ rPrintData.GetRenderData().m_pPostItShell : pShell; diff --git a/sw/source/ui/inc/srcview.hxx b/sw/source/ui/inc/srcview.hxx old mode 100644 new mode 100755 index d66096d4418b..687015759243 --- a/sw/source/ui/inc/srcview.hxx +++ b/sw/source/ui/inc/srcview.hxx @@ -28,7 +28,7 @@ * ************************************************************************/ #ifndef _SRCVIEW_HXX -#define _SRCIEW_HXX +#define _SRCVIEW_HXX #include #include diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index c7888f754ff0..9377f7182b18 100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -135,6 +135,8 @@ #include #include +#include +#include //#include #include @@ -178,6 +180,25 @@ using ::osl::FileBase; * ******************************************************************************/ +extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst ); + +SwPrintUIOptions * lcl_GetPrintUIOptions( + SwDocShell * pDocShell, + const SfxViewShell * pView ) +{ + if (!pDocShell) + return NULL; + + const BOOL bWebDoc = NULL != dynamic_cast< const SwWebDocShell * >(pDocShell); + const bool bSwSrcView = NULL != dynamic_cast< const SwSrcView * >(pView); + const SwView * pSwView = dynamic_cast< const SwView * >(pView); + const bool bHasSelection = pSwView ? pSwView->HasSelection( sal_False ) : false; // check for any selection, not just text selection + const bool bHasPostIts = lcl_GetPostIts( pDocShell->GetDoc(), 0 ); + return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts ); +} + +//////////////////////////////////////////////////////////// + SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc) { @@ -2614,10 +2635,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (!bIsSwSrcView && !m_pRenderData) m_pRenderData = new SwRenderData; if (!m_pPrintUIOptions) - { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); - } + m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); @@ -2753,11 +2771,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // otherwise be provided here! // if( ! m_pRenderData ) // m_pRenderData = new SwRenderData; - if( ! m_pPrintUIOptions ) - { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); - } + if (!m_pPrintUIOptions) + m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); m_pPrintUIOptions->processProperties( rxOptions ); const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); @@ -2913,10 +2928,7 @@ void SAL_CALL SwXTextDocument::render( if (!bIsSwSrcView && !m_pRenderData) m_pRenderData = new SwRenderData; if (!m_pPrintUIOptions) - { - const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc, bIsSwSrcView ); - } + m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); m_pPrintUIOptions->processProperties( rxOptions ); const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); -- cgit v1.2.3 From af1e3ee0d10c10d6f30d8700ddc677a86dbf82c3 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 10 Dec 2009 11:14:28 +0100 Subject: #i106914# apply configuration settings in UI --- sw/inc/printdata.hxx | 281 +++++++++++++++++++++------------------- sw/source/core/view/vprint.cxx | 105 ++++++++++----- sw/source/ui/config/optdlg.hrc | 8 +- sw/source/ui/config/optdlg.src | 53 +++++--- sw/source/ui/config/optpage.cxx | 50 +++---- sw/source/ui/inc/optpage.hxx | 8 +- sw/source/ui/uno/unotxdoc.cxx | 48 ++++++- 7 files changed, 328 insertions(+), 225 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 356ecb30b79e..75f16d01ace3 100755 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -52,6 +52,139 @@ class SwPrtOptions; class SwWrtShell; class SfxViewShell; +// forward declarations +class SwPrintUIOptions; +class SwRenderData; + +//////////////////////////////////////////////////////////// + + +class SwPrintData +{ + const SwPrintUIOptions * m_pPrintUIOptions; // not owner + const SwRenderData * m_pRenderData; // not owner + +public: + + sal_Bool bPrintGraphic, bPrintTable, bPrintDraw, bPrintControl, bPrintPageBackground, + bPrintBlackFont, + //#i81434# - printing of hidden text + bPrintHiddenText, bPrintTextPlaceholder, + bPrintLeftPages, bPrintRightPages, bPrintReverse, bPrintProspect, + bPrintProspectRTL, + bPrintSingleJobs, bPaperFromSetup, + // --> FME 2005-12-13 #b6354161# Print empty pages + bPrintEmptyPages, + // <-- + // #i56195# no field update while printing mail merge documents + bUpdateFieldsInPrinting, + bModified; + + sal_Int16 nPrintPostIts; + rtl::OUString sFaxName; + + SwPrintData() + { + m_pPrintUIOptions = NULL; + m_pRenderData = NULL; + + bPrintGraphic = + bPrintTable = + bPrintDraw = + bPrintControl = + bPrintLeftPages = + bPrintRightPages = + bPrintPageBackground = + bPrintEmptyPages = + bUpdateFieldsInPrinting = sal_True; + + bPaperFromSetup = + bPrintReverse = + bPrintProspect = + bPrintProspectRTL = + bPrintSingleJobs = + bModified = + bPrintBlackFont = + bPrintHiddenText = + bPrintTextPlaceholder = sal_False; + + nPrintPostIts = 0; + } + + virtual ~SwPrintData() {} + + sal_Bool operator==(const SwPrintData& rData)const + { + return + bPrintGraphic == rData.bPrintGraphic && + bPrintTable == rData.bPrintTable && + bPrintDraw == rData.bPrintDraw && + bPrintControl == rData.bPrintControl && + bPrintPageBackground== rData.bPrintPageBackground && + bPrintBlackFont == rData.bPrintBlackFont && + bPrintLeftPages == rData.bPrintLeftPages && + bPrintRightPages == rData.bPrintRightPages && + bPrintReverse == rData.bPrintReverse && + bPrintProspect == rData.bPrintProspect && + bPrintProspectRTL == rData.bPrintProspectRTL && + bPrintSingleJobs == rData.bPrintSingleJobs && + bPaperFromSetup == rData.bPaperFromSetup && + bPrintEmptyPages == rData.bPrintEmptyPages && + bUpdateFieldsInPrinting == rData.bUpdateFieldsInPrinting && + nPrintPostIts == rData.nPrintPostIts && + sFaxName == rData.sFaxName && + bPrintHiddenText == rData.bPrintHiddenText && + bPrintTextPlaceholder == rData.bPrintTextPlaceholder; + } + + // Note: in the context where this class ist used the pointers should always be valid + // during the lifetime of this object + const SwPrintUIOptions & GetPrintUIOptions() const { return *m_pPrintUIOptions; } + const SwRenderData & GetRenderData() const { return *m_pRenderData; } + void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; } + void SetRenderData( const SwRenderData *pData ) { m_pRenderData = pData; } + + sal_Bool IsPrintGraphic() const { return bPrintGraphic; } + sal_Bool IsPrintTable() const { return bPrintTable; } + sal_Bool IsPrintDraw() const { return bPrintDraw; } + sal_Bool IsPrintControl() const { return bPrintControl; } + sal_Bool IsPrintLeftPage() const { return bPrintLeftPages; } + sal_Bool IsPrintRightPage() const { return bPrintRightPages; } + sal_Bool IsPrintReverse() const { return bPrintReverse; } + sal_Bool IsPaperFromSetup() const { return bPaperFromSetup; } + sal_Bool IsPrintEmptyPages() const { return bPrintEmptyPages; } + sal_Bool IsPrintProspect() const { return bPrintProspect; } + sal_Bool IsPrintProspectRTL() const { return bPrintProspectRTL; } + sal_Bool IsPrintPageBackground() const { return bPrintPageBackground; } + sal_Bool IsPrintBlackFont() const { return bPrintBlackFont; } + sal_Bool IsPrintSingleJobs() const { return bPrintSingleJobs; } + sal_Int16 GetPrintPostIts() const { return nPrintPostIts; } + const rtl::OUString GetFaxName() const { return sFaxName; } + sal_Bool IsPrintHiddenText() const { return bPrintHiddenText; } + sal_Bool IsPrintTextPlaceholder() const { return bPrintTextPlaceholder; } + + void SetPrintGraphic( sal_Bool b ) { doSetModified(); bPrintGraphic = b; } + void SetPrintTable( sal_Bool b ) { doSetModified(); bPrintTable = b; } + void SetPrintDraw( sal_Bool b ) { doSetModified(); bPrintDraw = b; } + void SetPrintControl( sal_Bool b ) { doSetModified(); bPrintControl = b; } + void SetPrintLeftPage( sal_Bool b ) { doSetModified(); bPrintLeftPages = b; } + void SetPrintRightPage( sal_Bool b ) { doSetModified(); bPrintRightPages = b; } + void SetPrintReverse( sal_Bool b ) { doSetModified(); bPrintReverse = b; } + void SetPaperFromSetup( sal_Bool b ) { doSetModified(); bPaperFromSetup = b; } + void SetPrintEmptyPages( sal_Bool b ) { doSetModified(); bPrintEmptyPages = b; } + void SetPrintPostIts( sal_Int16 n ) { doSetModified(); nPrintPostIts = n; } + void SetPrintProspect( sal_Bool b ) { doSetModified(); bPrintProspect = b; } + void SetPrintProspect_RTL( sal_Bool b ) { doSetModified(); bPrintProspectRTL = b; } + void SetPrintPageBackground( sal_Bool b ) { doSetModified(); bPrintPageBackground = b; } + void SetPrintBlackFont( sal_Bool b ) { doSetModified(); bPrintBlackFont = b; } + void SetPrintSingleJobs( sal_Bool b ) { doSetModified(); bPrintSingleJobs = b; } + void SetFaxName( const rtl::OUString& rSet ) { sFaxName = rSet; } + void SetPrintHiddenText( sal_Bool b ) { doSetModified(); bPrintHiddenText = b; } + void SetPrintTextPlaceholder( sal_Bool b ) { doSetModified(); bPrintTextPlaceholder = b; } + + virtual void doSetModified () { bModified = sal_True;} +}; + //////////////////////////////////////////////////////////// @@ -59,13 +192,25 @@ class SfxViewShell; class SwPrintUIOptions : public vcl::PrinterOptionsHelper { OutputDevice* m_pLast; + const SwPrintData & m_rDefaultPrintData; public: - SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts ); - ~SwPrintUIOptions(); + SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ); + virtual ~SwPrintUIOptions(); bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + bool IsPrintFormControls() const { return getBoolValue( "PrintControls", m_rDefaultPrintData.bPrintControl ); } + bool IsPrintPageBackground() const { return getBoolValue( "PrintPageBackground", m_rDefaultPrintData.bPrintPageBackground ); } + bool IsPrintProspect() const { return getBoolValue( "PrintProspect", m_rDefaultPrintData.bPrintProspect ); } + bool IsPrintProspectRTL() const { return getIntValue( "PrintProspectRTL", m_rDefaultPrintData.bPrintProspectRTL ) ? true : false; } + bool IsPrintTextPlaceholders() const { return getBoolValue( "PrintTextPlaceholder", m_rDefaultPrintData.bPrintTextPlaceholder ); } + bool IsPrintHiddenText() const { return getBoolValue( "PrintHiddenText", m_rDefaultPrintData.bPrintHiddenText ); } + bool IsPrintWithBlackTextColor() const { return getBoolValue( "PrintBlackFonts", m_rDefaultPrintData.bPrintBlackFont ); } + sal_Int16 GetPrintPostItsType() const { return static_cast< sal_Int16 >(getIntValue( "PrintAnnotationMode", m_rDefaultPrintData.nPrintPostIts )); } + bool IsPaperFromSetup() const { return getBoolValue( "PrintPaperFromSetup", m_rDefaultPrintData.bPaperFromSetup ); } + bool IsPrintReverse() const { return false; /*handled by print dialog now*/ /*getBoolValue( "PrintReversed", m_rDefaultPrintData.bPrintReverse );*/ } + bool IsPrintLeftPages() const; bool IsPrintRightPages() const; bool IsPrintEmptyPages( bool bIsPDFExport ) const; @@ -130,8 +275,7 @@ public: const SwPrtOptions * GetSwPrtOptions() const { return m_pPrtOptions; } SwPrtOptions & GetSwPrtOptionsRef() { return *m_pPrtOptions; } void MakeSwPrtOptions( SwPrtOptions &rOptions, const SwDocShell *pDocShell, - const SwPrintUIOptions *pOpt, const SwRenderData *pData, - bool bIsSkipEmptyPages, bool bIsPDFExport ); + const SwPrintUIOptions *pOpt, const SwRenderData *pData, bool bIsPDFExport ); typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; @@ -167,135 +311,6 @@ public: }; -//////////////////////////////////////////////////////////// - - -class SwPrintData -{ - const SwPrintUIOptions * m_pPrintUIOptions; // not owner - const SwRenderData * m_pRenderData; // not owner - -public: - - sal_Bool bPrintGraphic, bPrintTable, bPrintDraw, bPrintControl, bPrintPageBackground, - bPrintBlackFont, - //#i81434# - printing of hidden text - bPrintHiddenText, bPrintTextPlaceholder, - bPrintLeftPages, bPrintRightPages, bPrintReverse, bPrintProspect, - bPrintProspectRTL, - bPrintSingleJobs, bPaperFromSetup, - // --> FME 2005-12-13 #b6354161# Print empty pages - bPrintEmptyPages, - // <-- - // #i56195# no field update while printing mail merge documents - bUpdateFieldsInPrinting, - bModified; - - sal_Int16 nPrintPostIts; - rtl::OUString sFaxName; - - SwPrintData() - { - m_pPrintUIOptions = NULL; - m_pRenderData = NULL; - - bPrintGraphic = - bPrintTable = - bPrintDraw = - bPrintControl = - bPrintLeftPages = - bPrintRightPages = - bPrintPageBackground = - bPrintEmptyPages = - bUpdateFieldsInPrinting = sal_True; - - bPaperFromSetup = - bPrintReverse = - bPrintProspect = - bPrintProspectRTL = - bPrintSingleJobs = - bModified = - bPrintBlackFont = - bPrintHiddenText = - bPrintTextPlaceholder = sal_False; - - nPrintPostIts = 0; - } - - virtual ~SwPrintData() {} - - sal_Bool operator==(const SwPrintData& rData)const - { - return - bPrintGraphic == rData.bPrintGraphic && - bPrintTable == rData.bPrintTable && - bPrintDraw == rData.bPrintDraw && - bPrintControl == rData.bPrintControl && - bPrintPageBackground== rData.bPrintPageBackground && - bPrintBlackFont == rData.bPrintBlackFont && - bPrintLeftPages == rData.bPrintLeftPages && - bPrintRightPages == rData.bPrintRightPages && - bPrintReverse == rData.bPrintReverse && - bPrintProspect == rData.bPrintProspect && - bPrintProspectRTL == rData.bPrintProspectRTL && - bPrintSingleJobs == rData.bPrintSingleJobs && - bPaperFromSetup == rData.bPaperFromSetup && - bPrintEmptyPages == rData.bPrintEmptyPages && - bUpdateFieldsInPrinting == rData.bUpdateFieldsInPrinting && - nPrintPostIts == rData.nPrintPostIts && - sFaxName == rData.sFaxName && - bPrintHiddenText == rData.bPrintHiddenText && - bPrintTextPlaceholder == rData.bPrintTextPlaceholder; - } - - // Note: in the context where this class ist used the pointers should always be valid - // during the lifetime of this object - const SwPrintUIOptions & GetPrintUIOptions() const { return *m_pPrintUIOptions; } - void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; } - const SwRenderData & GetRenderData() const { return *m_pRenderData; } - void SetRenderData( const SwRenderData *pData ) { m_pRenderData = pData; } - - sal_Bool IsPrintGraphic() const { return bPrintGraphic; } - sal_Bool IsPrintTable() const { return bPrintTable; } - sal_Bool IsPrintDraw() const { return bPrintDraw; } - sal_Bool IsPrintControl() const { return bPrintControl; } - sal_Bool IsPrintLeftPage() const { return bPrintLeftPages; } - sal_Bool IsPrintRightPage() const { return bPrintRightPages; } - sal_Bool IsPrintReverse() const { return bPrintReverse; } - sal_Bool IsPaperFromSetup() const { return bPaperFromSetup; } - sal_Bool IsPrintEmptyPages() const{ return bPrintEmptyPages; } - sal_Bool IsPrintProspect() const { return bPrintProspect; } - sal_Bool IsPrintProspectRTL() const { return bPrintProspectRTL; } - sal_Bool IsPrintPageBackground() const { return bPrintPageBackground; } - sal_Bool IsPrintBlackFont() const { return bPrintBlackFont; } - sal_Bool IsPrintSingleJobs() const { return bPrintSingleJobs; } - sal_Int16 GetPrintPostIts() const { return nPrintPostIts; } - const rtl::OUString GetFaxName() const{return sFaxName; } - sal_Bool IsPrintHiddenText() const {return bPrintHiddenText;} - sal_Bool IsPrintTextPlaceholder() const {return bPrintTextPlaceholder; } - - void SetPrintGraphic ( sal_Bool b ) { doSetModified(); bPrintGraphic = b;} - void SetPrintTable ( sal_Bool b ) { doSetModified(); bPrintTable = b;} - void SetPrintDraw ( sal_Bool b ) { doSetModified(); bPrintDraw = b;} - void SetPrintControl ( sal_Bool b ) { doSetModified(); bPrintControl = b; } - void SetPrintLeftPage ( sal_Bool b ) { doSetModified(); bPrintLeftPages = b;} - void SetPrintRightPage( sal_Bool b ) { doSetModified(); bPrintRightPages = b;} - void SetPrintReverse ( sal_Bool b ) { doSetModified(); bPrintReverse = b;} - void SetPaperFromSetup( sal_Bool b ) { doSetModified(); bPaperFromSetup = b;} - void SetPrintEmptyPages(sal_Bool b ) { doSetModified(); bPrintEmptyPages = b;} - void SetPrintPostIts ( sal_Int16 n){ doSetModified(); nPrintPostIts = n; } - void SetPrintProspect ( sal_Bool b ) { doSetModified(); bPrintProspect = b; } - void SetPrintProspect_RTL ( sal_Bool b ) { doSetModified(); bPrintProspectRTL = b; } - void SetPrintPageBackground(sal_Bool b){ doSetModified(); bPrintPageBackground = b;} - void SetPrintBlackFont(sal_Bool b){ doSetModified(); bPrintBlackFont = b;} - void SetPrintSingleJobs(sal_Bool b){ doSetModified(); bPrintSingleJobs = b;} - void SetFaxName(const rtl::OUString& rSet){sFaxName = rSet;} - void SetPrintHiddenText(sal_Bool b){ doSetModified(); bPrintHiddenText = b;} - void SetPrintTextPlaceholder(sal_Bool b){ doSetModified(); bPrintTextPlaceholder = b;} - - virtual void doSetModified () { bModified = sal_True;} -}; - //////////////////////////////////////////////////////////// #endif //_SW_PRINTDATA_HXX diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 66aa3741148f..87b8c5177e26 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -305,7 +305,6 @@ void SwRenderData::MakeSwPrtOptions( const SwDocShell *pDocShell, const SwPrintUIOptions *pOpt, const SwRenderData *pData, - bool bIsSkipEmptyPages, bool bIsPDFExport ) { if (!pDocShell || !pOpt || !pData) @@ -320,22 +319,22 @@ void SwRenderData::MakeSwPrtOptions( rOptions.bPrintGraphic = pOpt->IsPrintGraphics(); rOptions.bPrintTable = pOpt->IsPrintTables(); rOptions.bPrintDraw = pOpt->IsPrintDrawings(); - rOptions.bPrintControl = pOpt->getBoolValue( "PrintControls", rOptions.bPrintControl ); + rOptions.bPrintControl = pOpt->IsPrintFormControls(); rOptions.bPrintLeftPages = pOpt->IsPrintLeftPages(); rOptions.bPrintRightPages = pOpt->IsPrintRightPages(); - rOptions.bPrintPageBackground = pOpt->getBoolValue( "PrintPageBackground", rOptions.bPrintPageBackground ); - rOptions.bPrintEmptyPages = !bIsSkipEmptyPages; + rOptions.bPrintPageBackground = pOpt->IsPrintPageBackground(); + rOptions.bPrintEmptyPages = pOpt->IsPrintEmptyPages( bIsPDFExport ); // bUpdateFieldsInPrinting <-- not set here; mail merge only - rOptions.bPaperFromSetup = pOpt->getBoolValue( "PrintPaperFromSetup", rOptions.bPaperFromSetup ); - rOptions.bPrintReverse = pOpt->getBoolValue( "PrintReversed", rOptions.bPrintReverse ); - rOptions.bPrintProspect = pOpt->getBoolValue( "PrintProspect", rOptions.bPrintProspect ); - rOptions.bPrintProspectRTL = pOpt->getIntValue( "PrintProspectRTL", rOptions.bPrintProspectRTL ) ? true : false; + rOptions.bPaperFromSetup = pOpt->IsPaperFromSetup(); + rOptions.bPrintReverse = pOpt->IsPrintReverse(); + rOptions.bPrintProspect = pOpt->IsPrintProspect(); + rOptions.bPrintProspectRTL = pOpt->IsPrintProspectRTL(); // bPrintSingleJobs <-- not set here; mail merge and or configuration // bModified <-- not set here; mail merge only - rOptions.bPrintBlackFont = pOpt->getBoolValue( "PrintBlackFonts", rOptions.bPrintBlackFont ); - rOptions.bPrintHiddenText = pOpt->getBoolValue( "PrintHiddenText", rOptions.bPrintHiddenText ); - rOptions.bPrintTextPlaceholder = pOpt->getBoolValue( "PrintTextPlaceholder", rOptions.bPrintTextPlaceholder ); - rOptions.nPrintPostIts = static_cast< sal_Int16 >(pOpt->getIntValue( "PrintAnnotationMode", rOptions.nPrintPostIts )); + rOptions.bPrintBlackFont = pOpt->IsPrintWithBlackTextColor(); + rOptions.bPrintHiddenText = pOpt->IsPrintHiddenText(); + rOptions.bPrintTextPlaceholder = pOpt->IsPrintTextPlaceholders(); + rOptions.nPrintPostIts = pOpt->GetPrintPostItsType(); //! needs to be set after MakeOptions since the assignment operation in that //! function will destroy the pointers @@ -357,8 +356,14 @@ void SwRenderData::MakeSwPrtOptions( /*****************************************************************************/ -SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts ) : - m_pLast( NULL ) +SwPrintUIOptions::SwPrintUIOptions( + bool bWeb, + bool bSwSrcView, + bool bHasSelection, + bool bHasPostIts, + const SwPrintData &rDefaultPrintData ) : + m_pLast( NULL ), + m_rDefaultPrintData( rDefaultPrintData ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -396,62 +401,70 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelect m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); // create a bool option for background + bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), aLocalizedStrings.GetString( 3 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), - sal_True ); + bDefaultVal ); - // create a bool option for graphics + // create a bool option for pictures/graphics AND OLE and drawing objects as well + bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), aLocalizedStrings.GetString( 5 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), - sal_True ); + bDefaultVal ); if (!bWeb) { // create a bool option for hidden text + bDefaultVal = rDefaultPrintData.IsPrintHiddenText(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), aLocalizedStrings.GetString( 7 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), - sal_False ); + bDefaultVal ); // create a bool option for place holder + bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), aLocalizedStrings.GetString( 9 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), - sal_False ); + bDefaultVal ); } // create a bool option for controls + bDefaultVal = rDefaultPrintData.IsPrintControl(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), aLocalizedStrings.GetString( 11 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), - sal_True ); + bDefaultVal ); // create sub section for Color m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() ); - // create a bool option for black + // create a bool option for printing text with black font color + bDefaultVal = rDefaultPrintData.IsPrintBlackFont(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), aLocalizedStrings.GetString( 14 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), - sal_False ); + bDefaultVal ); // create subgroup for misc options m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); - // create a bool option for blank pages + // create a bool option for printing automatically inserted blank pages + bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), aLocalizedStrings.GetString( 17 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - sal_True ); + bDefaultVal ); // create a bool option for paper tray + bDefaultVal = rDefaultPrintData.IsPaperFromSetup(); vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), aLocalizedStrings.GetString( 19 ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), - sal_False, + bDefaultVal, aPaperTrayOpt ); @@ -498,6 +511,7 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelect aContentsOpt ); // create a list box for notes content + const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); aChoices.realloc( 4 ); aChoices[0] = aLocalizedStrings.GetString( 21 ); aChoices[1] = aLocalizedStrings.GetString( 22 ); @@ -512,7 +526,7 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelect aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), aChoices, - 0, + nPrintPostIts, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), aAnnotOpt ); @@ -534,23 +548,36 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelect uno::Sequence< rtl::OUString > aRLHelp( 1 ); aRLHelp[0] = aLocalizedStrings.GetString( 31 ); // create a choice option for all/left/right pages + // 0 : all pages (left & right) + // 1 : left pages + // 2 : right pages + DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRigthPage(), + "unexpected value combination" ); + sal_Int16 nPagesChoice = 0; + if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage()) + nPagesChoice = 1; + else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage()) + nPagesChoice = 2; m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ), aRLHelp, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), - aRLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) + aRLChoices, + nPagesChoice, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) ); } // create a bool option for brochure + bDefaultVal = rDefaultPrintData.IsPrintProspect(); rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), aLocalizedStrings.GetString( 34 ), aBrochurePropertyName, - sal_False, + bDefaultVal, aPageSetOpt ); - if( bCTL ) + if (bCTL) { // create a bool option for brochure RTL dependent on brochure uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); @@ -558,10 +585,16 @@ SwPrintUIOptions::SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelect aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); + // RTL brochure choices + // 0 : left-to-right + // 1 : right-to-left + const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0; m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), uno::Sequence< rtl::OUString >(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), - aBRTLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + aBRTLChoices, + nBRTLChoice, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), aBrochureRTLOpt ); } @@ -578,7 +611,7 @@ SwPrintUIOptions::~SwPrintUIOptions() bool SwPrintUIOptions::IsPrintLeftPages() const { // take care of different property names for the option. - // for compatibility the old name should win + // for compatibility the old name should win (may still be used for PDF export or via Uno API) // 0: left and right pages // 1: left pages only @@ -592,7 +625,7 @@ bool SwPrintUIOptions::IsPrintLeftPages() const bool SwPrintUIOptions::IsPrintRightPages() const { // take care of different property names for the option. - // for compatibility the old name should win + // for compatibility the old name should win (may still be used for PDF export or via Uno API) sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); bool bRes = nLRPages == 0 || nLRPages == 2; @@ -612,8 +645,8 @@ bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const bool SwPrintUIOptions::IsPrintTables() const { - // take care of different property names for the option. - // for compatibility the old name should win + // take care of different property names currently in use for this option. + // for compatibility the old name should win (may still be used for PDF export or via Uno API) // bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True ); // bRes = getBoolValue( "PrintTables", bRes ); @@ -625,7 +658,7 @@ bool SwPrintUIOptions::IsPrintTables() const bool SwPrintUIOptions::IsPrintGraphics() const { // take care of different property names for the option. - // for compatibility the old name should win + // for compatibility the old name should win (may still be used for PDF export or via Uno API) bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); bRes = getBoolValue( "PrintGraphics", bRes ); @@ -635,7 +668,7 @@ bool SwPrintUIOptions::IsPrintGraphics() const bool SwPrintUIOptions::IsPrintDrawings() const { // take care of different property names for the option. - // for compatibility the old name should win + // for compatibility the old name should win (may still be used for PDF export or via Uno API) bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True ); bRes = getBoolValue( "PrintDrawings", bRes ); diff --git a/sw/source/ui/config/optdlg.hrc b/sw/source/ui/config/optdlg.hrc index 2ada884e48c7..63ad384c7bd9 100644 --- a/sw/source/ui/config/optdlg.hrc +++ b/sw/source/ui/config/optdlg.hrc @@ -96,13 +96,13 @@ #define CB_CHAR_HIDDEN 61 // Print-Extra-Page #define CB_PGRF 61 -#define CB_PTAB 62 -#define CB_PDRAW 63 +//#define CB_PTAB 62 merged with CB_PGRF in printerpullpages +//#define CB_PDRAW 63 removed in printerpullpages #define CB_LEFTP 64 #define CB_RIGHTP 65 -#define CB_REVERSE 66 +//#define CB_REVERSE 66 removed in printerpullpages #define CB_PROSPECT 67 -#define CB_SINGLEJOBS 68 +//#define CB_SINGLEJOBS 68 removed in printerpullpages #define CB_CTRLFLD 69 #define CB_PAPERFROMSETUP 70 #define FL_1 71 diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index ce1d9ae22942..f509b1cdcc5c 100755 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -215,60 +215,66 @@ TabPage TP_OPTPRINT_PAGE Text [ en-US ] = "Contents" ; Group = TRUE ; }; - CheckBox CB_PGRF + CheckBox CB_PGRF /*functionally merged with CB_PDRAW*/ { Pos = MAP_APPFONT ( 12 , 14 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "~Graphics" ; + Text [ en-US ] = "~Pictures and objects" ; TabStop = TRUE ; Group = TRUE ; }; +/* + removed, tables now always get printed CheckBox CB_PTAB { Pos = MAP_APPFONT ( 12 , 27 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "~Tables" ; }; +*/ +/* + functionally merged with CB_PGRF (pictures and graphics) CheckBox CB_PDRAW { Pos = MAP_APPFONT ( 12 , 40 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "Dra~wings" ; }; +*/ CheckBox CB_CTRLFLD { - Pos = MAP_APPFONT ( 12 , 53 ) ; + Pos = MAP_APPFONT ( 12 , 27 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "Control~s" ; + Text [ en-US ] = "Form control~s" ; }; CheckBox CB_BACKGROUND { - Pos = MAP_APPFONT ( 12 , 66 ) ; + Pos = MAP_APPFONT ( 12 , 40 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "Ba~ckground" ; + Text [ en-US ] = "Page ba~ckground" ; }; CheckBox CB_BLACK_FONT { - Pos = MAP_APPFONT ( 12 , 79 ) ; + Pos = MAP_APPFONT ( 12 , 53 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "Print blac~k" ; + Text [ en-US ] = "Print text in blac~k" ; }; CheckBox CB_HIDDEN_TEXT { - Pos = MAP_APPFONT ( 12 , 92 ) ; + Pos = MAP_APPFONT ( 12 , 66 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "Hidden te~xt" ; }; CheckBox CB_TEXT_PLACEHOLDER { - Pos = MAP_APPFONT ( 12 , 105 ) ; + Pos = MAP_APPFONT ( 12 , 79 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "Text ~placeholder" ; }; FixedLine FL_SEP_PRT_LEFT { Pos = MAP_APPFONT ( 85 , 14 ) ; - Size = MAP_APPFONT ( 4 , 104 ) ; + Size = MAP_APPFONT ( 4 , 78 ) ; Vert = TRUE; }; FixedLine FL_2 @@ -292,21 +298,24 @@ TabPage TP_OPTPRINT_PAGE Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "~Right pages" ; }; +/* + removed, noe handled by the new print dialog (i.e. vcl) itself CheckBox CB_REVERSE { Pos = MAP_APPFONT ( 96 , 40 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "Re~versed" ; }; +*/ CheckBox CB_PROSPECT { - Pos = MAP_APPFONT ( 96 , 53 ) ; + Pos = MAP_APPFONT ( 96 , 40 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "Broch~ure" ; }; CheckBox CB_PROSPECT_RTL { - Pos = MAP_APPFONT ( 103 , 66 ) ; + Pos = MAP_APPFONT ( 103 , 53 ) ; Size = MAP_APPFONT ( 70 , 10 ) ; Text [ en-US ] = "Right to Left" ; Text [ x-comment ] = " "; @@ -340,7 +349,7 @@ TabPage TP_OPTPRINT_PAGE FixedLine FL_SEP_PRT_RIGHT { Pos = MAP_APPFONT ( 169 , 14 ) ; - Size = MAP_APPFONT ( 4 , 104 ) ; + Size = MAP_APPFONT ( 4 , 78 ) ; Vert = TRUE; }; FixedLine FL_3 @@ -352,35 +361,37 @@ TabPage TP_OPTPRINT_PAGE }; FixedLine FL_4 { - Pos = MAP_APPFONT ( 6 , 121 ) ; + Pos = MAP_APPFONT ( 6 , 95 ) ; Size = MAP_APPFONT ( 248 , 8 ) ; Group = TRUE ; Text [ en-US ] = "Other"; }; CheckBox CB_PRINTEMPTYPAGES { - Pos = MAP_APPFONT ( 12 , 132 ) ; + Pos = MAP_APPFONT ( 12 , 106 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Print ~automatically inserted blank pages"; }; +/* CheckBox CB_SINGLEJOBS { - Pos = MAP_APPFONT ( 12 , 145 ) ; + Pos = MAP_APPFONT ( 12 , 119 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Create s~ingle print jobs" ; }; +*/ CheckBox CB_PAPERFROMSETUP { - Pos = MAP_APPFONT ( 12 , 158 ) ; + Pos = MAP_APPFONT ( 12 , 119 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Paper tray from printer settings"; }; FixedText FT_FAX { - Pos = MAP_APPFONT ( 12 , 173 ) ; + Pos = MAP_APPFONT ( 12 , 134 ) ; Size = MAP_APPFONT ( 50 , 8 ) ; Group = TRUE ; Text [ en-US ] = "~Fax"; @@ -388,7 +399,7 @@ TabPage TP_OPTPRINT_PAGE ListBox LB_FAX { Border = TRUE ; - Pos = MAP_APPFONT ( 70 , 171 ) ; + Pos = MAP_APPFONT ( 70 , 132 ) ; Size = MAP_APPFONT ( 184 , 70 ) ; TabStop = TRUE ; DropDown = TRUE ; @@ -945,7 +956,7 @@ StringArray STR_PRINTOPTUI < "Page ba~ckground"; >; < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; < "~Pictures and objects"; >; - < "Specifies whether the graphics of your text document are printed"; >; + < "Specifies whether the graphics and drawing or OLE objects of your text document are printed"; >; < "Hidden te~xt"; >; < "Enable this option to print text that is marked as hidden."; >; < "~Text placeholder"; >; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 3c529263f66d..d609f1ed28cc 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -350,8 +350,8 @@ SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, SfxTabPage( pParent, SW_RES( TP_OPTPRINT_PAGE ), rCoreSet), aFL1 (this, SW_RES(FL_1)), aGrfCB (this, SW_RES(CB_PGRF)), - aTabCB (this, SW_RES(CB_PTAB)), - aDrawCB (this, SW_RES(CB_PDRAW)), +// aTabCB (this, SW_RES(CB_PTAB)), +// aDrawCB (this, SW_RES(CB_PDRAW)), aCtrlFldCB (this, SW_RES(CB_CTRLFLD)), aBackgroundCB (this, SW_RES(CB_BACKGROUND)), aBlackFontCB (this, SW_RES(CB_BLACK_FONT)), @@ -361,7 +361,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, aFL2 (this, SW_RES(FL_2)), aLeftPageCB (this, SW_RES(CB_LEFTP)), aRightPageCB (this, SW_RES(CB_RIGHTP)), - aReverseCB (this, SW_RES(CB_REVERSE)), +// aReverseCB (this, SW_RES(CB_REVERSE)), aProspectCB (this, SW_RES(CB_PROSPECT)), aProspectCB_RTL (this, SW_RES(CB_PROSPECT_RTL)), aSeparatorRFL (this, SW_RES(FL_SEP_PRT_RIGHT)), @@ -372,7 +372,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, aFL3 (this, SW_RES(FL_3)), aFL4 (this, SW_RES(FL_4)), aPrintEmptyPagesCB(this, SW_RES(CB_PRINTEMPTYPAGES)), - aSingleJobsCB (this, SW_RES(CB_SINGLEJOBS)), +// aSingleJobsCB (this, SW_RES(CB_SINGLEJOBS)), aPaperFromSetupCB(this, SW_RES(CB_PAPERFROMSETUP)), aFaxFT (this, SW_RES(FT_FAX)), aFaxLB (this, SW_RES(LB_FAX)), @@ -386,14 +386,14 @@ SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, aGrfCB.SetClickHdl( aLk ); aRightPageCB.SetClickHdl( aLk ); aLeftPageCB.SetClickHdl( aLk ); - aTabCB.SetClickHdl( aLk ); - aDrawCB.SetClickHdl( aLk ); +// aTabCB.SetClickHdl( aLk ); +// aDrawCB.SetClickHdl( aLk ); aCtrlFldCB.SetClickHdl( aLk ); aBackgroundCB.SetClickHdl( aLk ); aBlackFontCB.SetClickHdl( aLk ); aPrintHiddenTextCB.SetClickHdl( aLk ); aPrintTextPlaceholderCB.SetClickHdl( aLk ); - aReverseCB.SetClickHdl( aLk ); +// aReverseCB.SetClickHdl( aLk ); aProspectCB.SetClickHdl( aLk ); aProspectCB_RTL.SetClickHdl( aLk ); aPaperFromSetupCB.SetClickHdl( aLk ); @@ -402,27 +402,27 @@ SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, aEndRB.SetClickHdl( aLk ); aOnlyRB.SetClickHdl( aLk ); aNoRB.SetClickHdl( aLk ); - aSingleJobsCB.SetClickHdl( aLk ); +// aSingleJobsCB.SetClickHdl( aLk ); aFaxLB.SetSelectHdl( LINK( this, SwAddPrinterTabPage, SelectHdl ) ); const SfxPoolItem* pItem; if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem ) && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON) { - aDrawCB .Hide(); +// aDrawCB .Hide(); aLeftPageCB .Hide(); aRightPageCB .Hide(); aPrintHiddenTextCB.Hide(); aPrintTextPlaceholderCB.Hide(); - Point rPt(aReverseCB .GetPosPixel()); +// aReverseCB.SetPosPixel(aLeftPageCB.GetPosPixel()); + aProspectCB.SetPosPixel(aLeftPageCB.GetPosPixel()); + Point rPt( aRightPageCB.GetPosPixel() ); rPt.setX(rPt.getX() + 15); // indent aProspectCB_RTL.SetPosPixel(rPt); - aReverseCB.SetPosPixel(aLeftPageCB .GetPosPixel()); - aProspectCB.SetPosPixel(aRightPageCB .GetPosPixel()); - aPrintHiddenTextCB.SetPosPixel(aBlackFontCB.GetPosPixel()); - aBlackFontCB.SetPosPixel(aBackgroundCB.GetPosPixel()); - aBackgroundCB.SetPosPixel(aCtrlFldCB.GetPosPixel()); - aCtrlFldCB.SetPosPixel(aDrawCB.GetPosPixel()); +// aBlackFontCB.SetPosPixel(aBackgroundCB.GetPosPixel()); +// aPrintHiddenTextCB.SetPosPixel(aBlackFontCB.GetPosPixel()); +// aBackgroundCB.SetPosPixel(aCtrlFldCB.GetPosPixel()); +// aCtrlFldCB.SetPosPixel(aDrawCB.GetPosPixel()); } aProspectCB_RTL.Disable(); SvtCTLOptions aCTLOptions; @@ -465,8 +465,8 @@ BOOL SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet ) { SwAddPrinterItem aAddPrinterAttr (FN_PARAM_ADDPRINTER); aAddPrinterAttr.bPrintGraphic = aGrfCB.IsChecked(); - aAddPrinterAttr.bPrintTable = aTabCB.IsChecked(); - aAddPrinterAttr.bPrintDraw = aDrawCB.IsChecked(); + aAddPrinterAttr.bPrintTable = TRUE; // always enabled since CWS printerpullgpages /*aTabCB.IsChecked();*/ + aAddPrinterAttr.bPrintDraw = aGrfCB.IsChecked(); // UI merged with aGrfCB in CWS printerpullgpages /*aDrawCB.IsChecked()*/; aAddPrinterAttr.bPrintControl = aCtrlFldCB.IsChecked(); aAddPrinterAttr.bPrintPageBackground = aBackgroundCB.IsChecked(); aAddPrinterAttr.bPrintBlackFont = aBlackFontCB.IsChecked(); @@ -475,12 +475,12 @@ BOOL SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet ) aAddPrinterAttr.bPrintLeftPages = aLeftPageCB.IsChecked(); aAddPrinterAttr.bPrintRightPages = aRightPageCB.IsChecked(); - aAddPrinterAttr.bPrintReverse = aReverseCB.IsChecked(); + aAddPrinterAttr.bPrintReverse = FALSE; // handled by vcl itself since CWS printerpullpages /*aReverseCB.IsChecked()*/; aAddPrinterAttr.bPrintProspect = aProspectCB.IsChecked(); aAddPrinterAttr.bPrintProspectRTL = aProspectCB_RTL.IsChecked(); aAddPrinterAttr.bPaperFromSetup = aPaperFromSetupCB.IsChecked(); aAddPrinterAttr.bPrintEmptyPages = aPrintEmptyPagesCB.IsChecked(); - aAddPrinterAttr.bPrintSingleJobs = aSingleJobsCB.IsChecked(); + aAddPrinterAttr.bPrintSingleJobs = TRUE; // handled by vcl in new print dialog since CWS printerpullpages /*aSingleJobsCB.IsChecked()*/; if (aNoRB.IsChecked()) aAddPrinterAttr.nPrintPostIts = POSTITS_NONE; @@ -508,9 +508,9 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet& ) if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER , FALSE, (const SfxPoolItem**)&pAddPrinterAttr )) { - aGrfCB.Check( pAddPrinterAttr->bPrintGraphic); - aTabCB.Check( pAddPrinterAttr->bPrintTable); - aDrawCB.Check( pAddPrinterAttr->bPrintDraw); + aGrfCB.Check( pAddPrinterAttr->bPrintGraphic || pAddPrinterAttr->bPrintDraw ); +// aTabCB.Check( pAddPrinterAttr->bPrintTable); +// aDrawCB.Check( pAddPrinterAttr->bPrintDraw); aCtrlFldCB.Check( pAddPrinterAttr->bPrintControl); aBackgroundCB.Check( pAddPrinterAttr->bPrintPageBackground); aBlackFontCB.Check( pAddPrinterAttr->bPrintBlackFont); @@ -518,12 +518,12 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet& ) aPrintTextPlaceholderCB.Check(pAddPrinterAttr->bPrintTextPlaceholder); aLeftPageCB.Check( pAddPrinterAttr->bPrintLeftPages); aRightPageCB.Check( pAddPrinterAttr->bPrintRightPages); - aReverseCB.Check( pAddPrinterAttr->bPrintReverse); +// aReverseCB.Check( pAddPrinterAttr->bPrintReverse); aPaperFromSetupCB.Check(pAddPrinterAttr->bPaperFromSetup); aPrintEmptyPagesCB.Check(pAddPrinterAttr->bPrintEmptyPages); aProspectCB.Check( pAddPrinterAttr->bPrintProspect); aProspectCB_RTL.Check( pAddPrinterAttr->bPrintProspectRTL); - aSingleJobsCB.Check( pAddPrinterAttr->bPrintSingleJobs); +// aSingleJobsCB.Check( pAddPrinterAttr->bPrintSingleJobs); aNoRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ; aOnlyRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ; diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx index 592c581f4aa3..b2fe407964c4 100644 --- a/sw/source/ui/inc/optpage.hxx +++ b/sw/source/ui/inc/optpage.hxx @@ -119,8 +119,8 @@ class SwAddPrinterTabPage : public SfxTabPage { FixedLine aFL1; CheckBox aGrfCB; - CheckBox aTabCB; - CheckBox aDrawCB; +// CheckBox aTabCB; +// CheckBox aDrawCB; CheckBox aCtrlFldCB; CheckBox aBackgroundCB; CheckBox aBlackFontCB; @@ -132,7 +132,7 @@ class SwAddPrinterTabPage : public SfxTabPage FixedLine aFL2; CheckBox aLeftPageCB; CheckBox aRightPageCB; - CheckBox aReverseCB; +// CheckBox aReverseCB; CheckBox aProspectCB; CheckBox aProspectCB_RTL; @@ -145,7 +145,7 @@ class SwAddPrinterTabPage : public SfxTabPage FixedLine aFL3; FixedLine aFL4; CheckBox aPrintEmptyPagesCB; - CheckBox aSingleJobsCB; +// CheckBox aSingleJobsCB; CheckBox aPaperFromSetupCB; FixedText aFaxFT; ListBox aFaxLB; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 9377f7182b18..2ac3e7f64508 100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -194,7 +194,12 @@ SwPrintUIOptions * lcl_GetPrintUIOptions( const SwView * pSwView = dynamic_cast< const SwView * >(pView); const bool bHasSelection = pSwView ? pSwView->HasSelection( sal_False ) : false; // check for any selection, not just text selection const bool bHasPostIts = lcl_GetPostIts( pDocShell->GetDoc(), 0 ); - return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts ); + + // get default values to use in dialog from documents SwPrintData + const SwPrintData *pPrintData = pDocShell->GetDoc()->getPrintData(); + DBG_ASSERT( pPrintData, "failed to get SwPrintData from document" ); + + return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, *pPrintData ); } //////////////////////////////////////////////////////////// @@ -2619,6 +2624,42 @@ SwDoc * SwXTextDocument::GetRenderDoc( /* -----------------------------23.08.02 16:00-------------------------------- ---------------------------------------------------------------------------*/ + +static void lcl_SavePrintUIOptionsToDocumentPrintData( + SwDoc &rDoc, + const SwPrintUIOptions &rPrintUIOptions, + bool bIsPDFEXport ) +{ + if (!rDoc.getPrintData()) + { + SwPrintData *pTmpData = new SwPrintData; + rDoc.setPrintData ( *pTmpData ); + delete pTmpData; // setPrintData does make its own copy! + } + + SwPrintData *pDocPrintData = rDoc.getPrintData(); + + pDocPrintData->SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() ); + pDocPrintData->SetPrintTable( rPrintUIOptions.IsPrintTables() ); + pDocPrintData->SetPrintDraw( rPrintUIOptions.IsPrintDrawings() ); + pDocPrintData->SetPrintControl( rPrintUIOptions.IsPrintFormControls() ); + pDocPrintData->SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() ); + pDocPrintData->SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() ); + pDocPrintData->SetPrintReverse( rPrintUIOptions.IsPrintReverse() ); + pDocPrintData->SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() ); + pDocPrintData->SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) ); + pDocPrintData->SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() ); + pDocPrintData->SetPrintProspect( rPrintUIOptions.IsPrintProspect() ); + pDocPrintData->SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() ); + pDocPrintData->SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() ); + pDocPrintData->SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() ); + // pDocPrintData->SetPrintSingleJobs( b ); handled by File/Print dialog itself + // pDocPrintData->SetFaxName( s ); n/a in File/Print dialog + pDocPrintData->SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() ); + pDocPrintData->SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() ); +} + + sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const uno::Any& rSelection, const uno::Sequence< beans::PropertyValue >& rxOptions ) @@ -2644,6 +2685,9 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (!pDoc || !pView) return 0; + // save current UI options from the print dialog for the next call to that dialog + lcl_SavePrintUIOptionsToDocumentPrintData( *pDoc, *m_pPrintUIOptions, bIsPDFExport ); + sal_Int32 nRet = 0; if (bIsSwSrcView) { @@ -2678,7 +2722,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, - m_pPrintUIOptions, m_pRenderData, bIsSkipEmptyPages, bIsPDFExport ); + m_pPrintUIOptions, m_pRenderData, bIsPDFExport ); //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); const TypeId aSwViewTypeId = TYPE(SwView); -- cgit v1.2.3 From fe74c5cb8d987483b67cfa153102e16d7dc95a96 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 10 Dec 2009 18:01:55 +0100 Subject: fix warnings --- sw/source/core/layout/paintfrm.cxx | 8 ++++---- sw/source/ui/uno/unotxdoc.cxx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 6181269b96b8..94bafc442117 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3190,7 +3190,7 @@ SwShortCut::SwShortCut( const SwFrm& rFrm, const SwRect& rRect ) } } -void SwLayoutFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const +void SwLayoutFrm::Paint( const SwRect& rRect, const SwPrtOptions* /* pPrintData */ ) const { ViewShell *pSh = GetShell(); @@ -3478,7 +3478,7 @@ BOOL SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh ) /************************************************************************* |* SwCellFrm::Paint( const SwRect& ) const |*************************************************************************/ -void SwCellFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const +void SwCellFrm::Paint( const SwRect& rRect, const SwPrtOptions* /* pPrintData */ ) const { if ( GetLayoutRowSpan() >= 1 ) SwLayoutFrm::Paint( rRect ); @@ -3497,7 +3497,7 @@ void SwCellFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con void MA_FASTCALL lcl_PaintLowerBorders( const SwLayoutFrm *pLay, const SwRect &rRect, const SwPageFrm *pPage ); -void SwFlyFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const +void SwFlyFrm::Paint( const SwRect& rRect, const SwPrtOptions* /* pPrintData */ ) const { //wegen der Ueberlappung von Rahmen und Zeichenobjekten muessen die //Flys ihre Umrandung (und die der Innenliegenden) direkt ausgeben. @@ -3732,7 +3732,7 @@ void SwFlyFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) cons |* |*************************************************************************/ -void SwTabFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const +void SwTabFrm::Paint( const SwRect& rRect, const SwPrtOptions* /* pPrintData */ ) const { if ( pGlobalShell->GetViewOptions()->IsTable() ) { diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 2ac3e7f64508..e689306262f4 100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2678,7 +2678,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (!m_pPrintUIOptions) m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); + // const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); -- cgit v1.2.3 From 9195c2b45eb5488e939bb88281d45cb45fbe4861 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 11 Dec 2009 11:34:10 +0100 Subject: #i106926# fixed hidden text in view when cancelling print to file --- sw/inc/unotxdoc.hxx | 24 +++----- sw/inc/viewopt.hxx | 3 +- sw/source/core/view/vprint.cxx | 6 +- sw/source/ui/uno/unotxdoc.cxx | 121 ++++++++++++++++++----------------------- 4 files changed, 68 insertions(+), 86 deletions(-) diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index a5c39b2d928d..45a890aeab7d 100755 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -29,9 +29,11 @@ ************************************************************************/ #ifndef _UNOTXDOC_HXX #define _UNOTXDOC_HXX + #include "swdllapi.h" #include #include + #include #include #include @@ -79,6 +81,8 @@ #include // helper for implementations #include +#include + #define __IFC32 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \ Ifc17, Ifc18, Ifc19, Ifc20, Ifc21, Ifc22, Ifc23, Ifc24, Ifc25, Ifc26, Ifc27, Ifc28, Ifc29, Ifc30, Ifc31, Ifc32 @@ -129,7 +133,6 @@ class SwPrintUIOptions; class SwPrintData; class SwRenderData; class SwPrtOptions; -class SwViewOption; class SwWrtShell; @@ -597,20 +600,11 @@ public: -----------------------------------------------------------------------*/ class SwViewOptionAdjust_Impl { - // options not available in the File/Print UI, should be turned off for - // printing and PDF export if they are enabled - bool m_bSwitchOff_IsFldName; - - // options available in the File/Print UI, should be turned of for PDF export - // and otherwise set (or not) according to - // pPrtOptions->bPrintHiddenText and pPrtOptions->bPrintTextPlaceholder - bool m_bToggle_HiddenChar; - bool m_bToggle_HiddenField; - bool m_bToggle_HiddenParagraphs; - bool m_bToggle_PlaceHolderView; - - SwViewOption* m_pViewOption; - SwWrtShell& m_rShell; + SwWrtShell & m_rShell; + SwViewOption m_aOldViewOptions; + SwViewOption m_aRenderViewOptions; // view options to use when rendering for PDF export or printing + bool m_bRestoreViewOptions; + public: SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ); ~SwViewOptionAdjust_Impl(); diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 2ac47e284b49..8b2e4d5aa6fa 100755 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -455,7 +455,8 @@ public: SwViewOption& operator=( const SwViewOption &rOpt ); // Vergleichsmethoden BOOL IsEqualFlags ( const SwViewOption &rOpt ) const; - inline BOOL operator==( const SwViewOption &rOpt ) const; + inline BOOL operator == ( const SwViewOption &rOpt ) const; + inline BOOL operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); } /*--------------------------------------------------------------------------- diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 87b8c5177e26..0de4da31370d 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -285,14 +285,16 @@ void SwRenderData::DeletePostItData() void SwRenderData::ViewOptionAdjustStart( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ) { if (m_pViewOptionAdjust) - delete m_pViewOptionAdjust; + { + DBG_ASSERT( 0, "error: there should be no ViewOptionAdjustStart active when calling it again" ); + } m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, pPrtOptions ); } void SwRenderData::ViewOptionAdjustStop() { - if (IsViewOptionAdjust()) + if (m_pViewOptionAdjust) { delete m_pViewOptionAdjust; m_pViewOptionAdjust = 0; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 2ac3e7f64508..4c3a86b97dce 100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2720,12 +2720,19 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // We don't want that! Thus we disable updating of the view. pWrtShell->StartAction(); + const TypeId aSwViewTypeId = TYPE(SwView); + if (pView->IsA(aSwViewTypeId)) + { + // if there already is a not stopped view options adjustment we should return to + // the original values before calculating the new ones. + if (m_pRenderData->IsViewOptionAdjust()) + m_pRenderData->ViewOptionAdjustStop(); + } + m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, m_pPrintUIOptions, m_pRenderData, bIsPDFExport ); - //SwViewOptionAdjust_Impl aAdjust(*pWrtShell); - const TypeId aSwViewTypeId = TYPE(SwView); if (pView->IsA(aSwViewTypeId)) { // PDF export should not make use of the SwPrtOptions @@ -4057,11 +4064,12 @@ void SwXDocumentPropertyHelper::onChange() SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ) : - m_pViewOption(0), - m_rShell(rSh) + m_rShell(rSh), + m_aOldViewOptions( *rSh.GetViewOptions() ), + m_bRestoreViewOptions( false ) { - const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions(); - + // to avoid unnecessary reformatting the view options related to the content + // below should only change if necessary, that is if respective content is present const bool bContainsHiddenChars = m_rShell.GetDoc()->ContainsHiddenChars(); const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENTXTFLD ); const bool bContainsHiddenFields = pFldType && pFldType->GetDepends(); @@ -4069,54 +4077,47 @@ SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( const bool bContainsHiddenParagraphs = pFldType && pFldType->GetDepends(); pFldType = m_rShell.GetDoc()->GetSysFldType( RES_JUMPEDITFLD ); const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends(); - - m_bSwitchOff_IsFldName = m_rShell.IsAnyFieldInDoc() && pCurrentViewOptions->IsFldName(); - - // for printing only (not PDF export) take print options into account - if (pPrtOptions) - { - m_bToggle_PlaceHolderView = bContainsPlaceHolders && pPrtOptions->bPrintTextPlaceholder != pCurrentViewOptions->IsShowPlaceHolderFields(); - m_bToggle_HiddenChar = bContainsHiddenChars && pPrtOptions->bPrintHiddenText != pCurrentViewOptions->IsShowHiddenChar( TRUE ); - m_bToggle_HiddenField = bContainsHiddenFields && pPrtOptions->bPrintHiddenText != pCurrentViewOptions->IsShowHiddenField(); - m_bToggle_HiddenParagraphs = bContainsHiddenParagraphs && pPrtOptions->bPrintHiddenText != pCurrentViewOptions->IsShowHiddenPara(); - } - else + const bool bContainsFields = m_rShell.IsAnyFieldInDoc(); + + // disable anything in the view that should not be printed (or exported to PDF) by default + // (see also dialog "Tools/Options - StarOffice Writer - Formatting Aids" + // in section "Display of ...") + m_aRenderViewOptions = m_aOldViewOptions; + m_aRenderViewOptions.SetParagraph( FALSE ); // paragraph end + m_aRenderViewOptions.SetSoftHyph( FALSE ); // aka custom hyphens + m_aRenderViewOptions.SetBlank( FALSE ); // spaces + m_aRenderViewOptions.SetHardBlank( FALSE ); // non-breaking spaces + m_aRenderViewOptions.SetTab( FALSE ); // tabs + m_aRenderViewOptions.SetLineBreak( FALSE ); // breaks (type 1) + m_aRenderViewOptions.SetPageBreak( FALSE ); // breaks (type 2) + m_aRenderViewOptions.SetColumnBreak( FALSE ); // breaks (type 3) + BOOL bVal = pPrtOptions? pPrtOptions->bPrintHiddenText : FALSE; + if (bContainsHiddenChars) + m_aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text + if (bContainsHiddenFields) + m_aRenderViewOptions.SetShowHiddenField( bVal ); + if (bContainsHiddenParagraphs) + m_aRenderViewOptions.SetShowHiddenPara( bVal ); + + if (bContainsPlaceHolders) { - //toggle painting of placeholder fields - m_bToggle_PlaceHolderView = bContainsPlaceHolders && pCurrentViewOptions->IsShowPlaceHolderFields(); - //toggle display of hidden characters if on and hidden characters are in use - m_bToggle_HiddenChar = bContainsHiddenChars && pCurrentViewOptions->IsShowHiddenChar( FALSE ); - //toggle display of hidden fields if on and hidden fields are in use - m_bToggle_HiddenField = bContainsHiddenFields && pCurrentViewOptions->IsShowHiddenField(); - //toggle display of hidden paragraphs if on and hidden paragraphs are in use - m_bToggle_HiddenParagraphs = bContainsHiddenParagraphs && pCurrentViewOptions->IsShowHiddenPara(); + // should always be printed in PDF export! + bVal = pPrtOptions ? pPrtOptions->bPrintTextPlaceholder : TRUE; + m_aRenderViewOptions.SetShowPlaceHolderFields( bVal ); } - // bApplyViewOptions should only be true if necessary to avoid reformating if not required, - bool bApplyViewOptions = m_bSwitchOff_IsFldName; - bApplyViewOptions |= m_bToggle_PlaceHolderView; - bApplyViewOptions |= m_bToggle_HiddenChar; - bApplyViewOptions |= m_bToggle_HiddenField; - bApplyViewOptions |= m_bToggle_HiddenParagraphs; - if(bApplyViewOptions) + if (bContainsFields) + m_aRenderViewOptions.SetFldName( FALSE ); + + // we don't want to print those. + // Also this flag has effect on printing of other content e.g. hidden text + m_aRenderViewOptions.SetViewMetaChars( FALSE ); + + if (m_aOldViewOptions != m_aRenderViewOptions) // check if reformatting is necessary { - m_pViewOption = new SwViewOption( *pCurrentViewOptions ); - - // set flag to hint that everything should be formatted for printing, - // (needed at some places to print hidden text if that option is set in the dialog, etc.) - m_pViewOption->SetPrinting( TRUE ); - - if(m_bSwitchOff_IsFldName) - m_pViewOption->SetFldName(FALSE); - if(m_bToggle_PlaceHolderView) - m_pViewOption->SetShowPlaceHolderFields( !pCurrentViewOptions->IsShowPlaceHolderFields() ); - if(m_bToggle_HiddenChar) - m_pViewOption->SetShowHiddenChar( !pCurrentViewOptions->IsShowHiddenChar( TRUE ) ); - if(m_bToggle_HiddenField) - m_pViewOption->SetShowHiddenField( !pCurrentViewOptions->IsShowHiddenField() ); - if(m_bToggle_HiddenParagraphs) - m_pViewOption->SetShowHiddenPara( !pCurrentViewOptions->IsShowHiddenPara() ); - SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); + m_aRenderViewOptions.SetPrinting( pPrtOptions != NULL ); + m_bRestoreViewOptions = true; + SW_MOD()->ApplyUsrPref( m_aRenderViewOptions, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); } } @@ -4124,24 +4125,8 @@ SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() { - if(m_pViewOption) - { - m_pViewOption->SetPrinting( FALSE ); - - const SwViewOption* pCurrentViewOptions = m_rShell.GetViewOptions(); - if(m_bSwitchOff_IsFldName) - m_pViewOption->SetFldName(TRUE); - if(m_bToggle_HiddenChar) - m_pViewOption->SetShowHiddenChar( !pCurrentViewOptions->IsShowHiddenChar() ); - if(m_bToggle_HiddenField) - m_pViewOption->SetShowHiddenField( !pCurrentViewOptions->IsShowHiddenField() ); - if(m_bToggle_HiddenParagraphs) - m_pViewOption->SetShowHiddenPara( !pCurrentViewOptions->IsShowHiddenPara() ); - if(m_bToggle_PlaceHolderView) - m_pViewOption->SetShowPlaceHolderFields( !pCurrentViewOptions->IsShowPlaceHolderFields() ); - SW_MOD()->ApplyUsrPref(*m_pViewOption, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); - delete m_pViewOption; m_pViewOption = NULL; - } + if (m_bRestoreViewOptions) + SW_MOD()->ApplyUsrPref( m_aOldViewOptions, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); } /*****************************************************************************/ -- cgit v1.2.3 From af8a4cf23931e9b26d31683292dfe56cec2e97cb Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 11 Dec 2009 16:17:51 +0100 Subject: #i106926# fixing view settings after rendering --- sw/inc/printdata.hxx | 3 +- sw/inc/unotxdoc.hxx | 8 +++-- sw/source/core/view/vprint.cxx | 12 +++++-- sw/source/ui/uno/unotxdoc.cxx | 80 +++++++++++++++++++++--------------------- 4 files changed, 56 insertions(+), 47 deletions(-) diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 75f16d01ace3..3368418354cf 100755 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -267,7 +267,8 @@ public: void DeletePostItData(); bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != 0; } - void ViewOptionAdjustStart( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ); + void ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions ); + void ViewOptionAdjust( const SwPrtOptions *pPrtOptions ); void ViewOptionAdjustStop(); bool HasSwPrtOptions() const { return m_pPrtOptions != 0; } diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 45a890aeab7d..39438bbc3add 100755 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -602,12 +602,14 @@ class SwViewOptionAdjust_Impl { SwWrtShell & m_rShell; SwViewOption m_aOldViewOptions; - SwViewOption m_aRenderViewOptions; // view options to use when rendering for PDF export or printing - bool m_bRestoreViewOptions; +// SwViewOption m_aRenderViewOptions; // view options to use when rendering for PDF export or printing +// bool m_bRestoreViewOptions; public: - SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ); + SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwViewOption &rViewOptions ); ~SwViewOptionAdjust_Impl(); + + void AdjustViewOptions( const SwPrtOptions *pPrtOptions ); }; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 0de4da31370d..bab2428c0b67 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -282,13 +282,19 @@ void SwRenderData::DeletePostItData() } -void SwRenderData::ViewOptionAdjustStart( SwWrtShell& rSh, const SwPrtOptions *pPrtOptions ) +void SwRenderData::ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions ) { if (m_pViewOptionAdjust) { - DBG_ASSERT( 0, "error: there should be no ViewOptionAdjustStart active when calling it again" ); + DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" ); } - m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, pPrtOptions ); + m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions ); +} + + +void SwRenderData::ViewOptionAdjust( const SwPrtOptions *pPrtOptions ) +{ + m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions ); } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 1917228b347b..6c6194555559 100755 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2723,10 +2723,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const TypeId aSwViewTypeId = TYPE(SwView); if (pView->IsA(aSwViewTypeId)) { - // if there already is a not stopped view options adjustment we should return to - // the original values before calculating the new ones. - if (m_pRenderData->IsViewOptionAdjust()) - m_pRenderData->ViewOptionAdjustStop(); + if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust()) + m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() ); } m_pRenderData->SetSwPrtOptions( new SwPrtOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ) ); @@ -2737,7 +2735,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( { // PDF export should not make use of the SwPrtOptions const SwPrtOptions *pPrtOptions = bIsPDFExport? NULL : m_pRenderData->GetSwPrtOptions(); - m_pRenderData->ViewOptionAdjustStart( *((SwView*)pView)->GetWrtShellPtr(), pPrtOptions ); + m_pRenderData->ViewOptionAdjust( pPrtOptions ); } // since printing now also use the API for PDF export this option @@ -3078,7 +3076,7 @@ void SAL_CALL SwXTextDocument::render( // -> do clean-up of data if (bLastPage) { - // #i96167# haggai: delete pViewOptionsAdjust here because it makes use + // #i96167# haggai: delete ViewOptionsAdjust here because it makes use // of the shell, which might get destroyed in lcl_DisposeView! if (m_pRenderData && m_pRenderData->IsViewOptionAdjust()) m_pRenderData->ViewOptionAdjustStop(); @@ -4061,12 +4059,21 @@ void SwXDocumentPropertyHelper::onChange() /*****************************************************************************/ -SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( - SwWrtShell& rSh, - const SwPrtOptions *pPrtOptions ) : - m_rShell(rSh), - m_aOldViewOptions( *rSh.GetViewOptions() ), - m_bRestoreViewOptions( false ) +SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwViewOption &rViewOptions ) : + m_rShell( rSh ), + m_aOldViewOptions( rViewOptions ) +{ +} + + +SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() +{ + m_rShell.ApplyViewOptions( m_aOldViewOptions ); +} + + +void SwViewOptionAdjust_Impl::AdjustViewOptions( + const SwPrtOptions *pPrtOptions ) { // to avoid unnecessary reformatting the view options related to the content // below should only change if necessary, that is if respective content is present @@ -4079,56 +4086,49 @@ SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends(); const bool bContainsFields = m_rShell.IsAnyFieldInDoc(); + SwViewOption aRenderViewOptions( m_aOldViewOptions ); + // disable anything in the view that should not be printed (or exported to PDF) by default // (see also dialog "Tools/Options - StarOffice Writer - Formatting Aids" // in section "Display of ...") - m_aRenderViewOptions = m_aOldViewOptions; - m_aRenderViewOptions.SetParagraph( FALSE ); // paragraph end - m_aRenderViewOptions.SetSoftHyph( FALSE ); // aka custom hyphens - m_aRenderViewOptions.SetBlank( FALSE ); // spaces - m_aRenderViewOptions.SetHardBlank( FALSE ); // non-breaking spaces - m_aRenderViewOptions.SetTab( FALSE ); // tabs - m_aRenderViewOptions.SetLineBreak( FALSE ); // breaks (type 1) - m_aRenderViewOptions.SetPageBreak( FALSE ); // breaks (type 2) - m_aRenderViewOptions.SetColumnBreak( FALSE ); // breaks (type 3) + aRenderViewOptions.SetParagraph( FALSE ); // paragraph end + aRenderViewOptions.SetSoftHyph( FALSE ); // aka custom hyphens + aRenderViewOptions.SetBlank( FALSE ); // spaces + aRenderViewOptions.SetHardBlank( FALSE ); // non-breaking spaces + aRenderViewOptions.SetTab( FALSE ); // tabs + aRenderViewOptions.SetLineBreak( FALSE ); // breaks (type 1) + aRenderViewOptions.SetPageBreak( FALSE ); // breaks (type 2) + aRenderViewOptions.SetColumnBreak( FALSE ); // breaks (type 3) BOOL bVal = pPrtOptions? pPrtOptions->bPrintHiddenText : FALSE; if (bContainsHiddenChars) - m_aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text + aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text if (bContainsHiddenFields) - m_aRenderViewOptions.SetShowHiddenField( bVal ); + aRenderViewOptions.SetShowHiddenField( bVal ); if (bContainsHiddenParagraphs) - m_aRenderViewOptions.SetShowHiddenPara( bVal ); + aRenderViewOptions.SetShowHiddenPara( bVal ); if (bContainsPlaceHolders) { // should always be printed in PDF export! bVal = pPrtOptions ? pPrtOptions->bPrintTextPlaceholder : TRUE; - m_aRenderViewOptions.SetShowPlaceHolderFields( bVal ); + aRenderViewOptions.SetShowPlaceHolderFields( bVal ); } if (bContainsFields) - m_aRenderViewOptions.SetFldName( FALSE ); + aRenderViewOptions.SetFldName( FALSE ); - // we don't want to print those. - // Also this flag has effect on printing of other content e.g. hidden text - m_aRenderViewOptions.SetViewMetaChars( FALSE ); + // we need to set this flag in order to get to see the visible effect of + // some of the above settings (needed for correct rendering) + aRenderViewOptions.SetViewMetaChars( TRUE ); - if (m_aOldViewOptions != m_aRenderViewOptions) // check if reformatting is necessary + if (m_aOldViewOptions != aRenderViewOptions) // check if reformatting is necessary { - m_aRenderViewOptions.SetPrinting( pPrtOptions != NULL ); - m_bRestoreViewOptions = true; - SW_MOD()->ApplyUsrPref( m_aRenderViewOptions, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); + aRenderViewOptions.SetPrinting( pPrtOptions != NULL ); + m_rShell.ApplyViewOptions( aRenderViewOptions ); } - } -SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() -{ - if (m_bRestoreViewOptions) - SW_MOD()->ApplyUsrPref( m_aOldViewOptions, &m_rShell.GetView(), VIEWOPT_DEST_VIEW_ONLY ); -} - /*****************************************************************************/ -- cgit v1.2.3 From b610fe1983c35ea9073418ebb5cc2e6f056f039a Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Mon, 14 Dec 2009 12:25:38 +0000 Subject: #161286# applied patch and solved crash --- sw/source/filter/ww8/ww8graf.cxx | 5 ++-- sw/source/filter/ww8/ww8par.cxx | 15 ++++++----- sw/source/filter/ww8/ww8par2.cxx | 31 ++++++++++++++-------- sw/source/filter/ww8/ww8scan.cxx | 55 ++++++++++++++++++++++++++++------------ sw/source/filter/ww8/ww8scan.hxx | 2 ++ 5 files changed, 73 insertions(+), 35 deletions(-) diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 0553267d12ed..e1c5b2509228 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -506,14 +506,15 @@ ESelection SwWW8ImplReader::GetESelection( long nCpStart, long nCpEnd ) // ItemSet gestopft. void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, USHORT nColl ) { - if( nColl < nColls && pCollA[nColl].pFmt && pCollA[nColl].bColl ) + SwWW8StyInf * pStyInf = GetStyle(nColl); + if( pStyInf != NULL && pStyInf->pFmt && pStyInf->bColl ) { const SfxPoolItem* pItem; for( USHORT i = POOLATTR_BEGIN; i < POOLATTR_END; i++ ) { //If we are set in the source and not set in the destination //then add it in. - if ( SFX_ITEM_SET == pCollA[nColl].pFmt->GetItemState( + if ( SFX_ITEM_SET == pStyInf->pFmt->GetItemState( i, true, &pItem ) ) { SfxItemPool *pEditPool = rS.GetPool(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b92f80c85290..05d79c7d6abf 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -989,7 +989,7 @@ const SfxPoolItem* SwWW8FltControlStack::GetFmtAttr(const SwPosition& rPos, SfxItemState eState = SFX_ITEM_DEFAULT; if (const SfxItemSet *pSet = pNd->GetpSwAttrSet()) eState = pSet->GetItemState(RES_LR_SPACE, false); - if (eState != SFX_ITEM_SET) + if (eState != SFX_ITEM_SET && rReader.pCollA != NULL) pItem = &(rReader.pCollA[rReader.nAktColl].maWordLR); } @@ -2163,7 +2163,7 @@ CharSet SwWW8ImplReader::GetCurrentCharSet() eSrcCharSet = maFontSrcCharSets.top(); if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1)) eSrcCharSet = pCollA[nCharFmt].GetCharSet(); - if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) + if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl)) eSrcCharSet = pCollA[nAktColl].GetCharSet(); if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) { // patch from cmc for #i52786# @@ -2221,10 +2221,13 @@ CharSet SwWW8ImplReader::GetCurrentCJKCharSet() { if (!maFontSrcCJKCharSets.empty()) eSrcCharSet = maFontSrcCJKCharSets.top(); - if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1)) - eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet(); - if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) - eSrcCharSet = pCollA[nAktColl].GetCJKCharSet(); + if (pCollA != NULL) + { + if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1)) + eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet(); + if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) + eSrcCharSet = pCollA[nAktColl].GetCJKCharSet(); + } if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) { // patch from cmc for #i52786# /* diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 795cfb749531..afbf4b3593c1 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -827,7 +827,8 @@ void SwWW8ImplReader::Read_ANLevelNo( USHORT, const BYTE* pData, short nLen ) { // nur fuer SwTxtFmtColl, nicht CharFmt // WW: 0 = no Numbering - if (pCollA[nAktColl].bColl && *pData) + SwWW8StyInf * pColl = GetStyle(nAktColl); + if (pColl != NULL && pColl->bColl && *pData) { // Bereich WW:1..9 -> SW:0..8 keine Aufzaehlung / Nummerierung @@ -861,12 +862,16 @@ void SwWW8ImplReader::Read_ANLevelNo( USHORT, const BYTE* pData, short nLen ) void SwWW8ImplReader::Read_ANLevelDesc( USHORT, const BYTE* pData, short nLen ) // Sprm 12 { - if( !pAktColl || nLen <= 0 // nur bei Styledef - || !pCollA[nAktColl].bColl // CharFmt -> ignorieren - || ( nIniFlags & WW8FL_NO_OUTLINE ) ){ - nSwNumLevel = 0xff; - return; + { + SwWW8StyInf * pStyInf = GetStyle(nAktColl); + if( !pAktColl || nLen <= 0 // nur bei Styledef + || (pStyInf && !pStyInf->bColl) // CharFmt -> ignorieren + || ( nIniFlags & WW8FL_NO_OUTLINE ) ){ + nSwNumLevel = 0xff; + return; + } } + if( nSwNumLevel <= MAXLEVEL // Bereich WW:1..9 -> SW:0..8 && nSwNumLevel <= 9 ){ // keine Aufzaehlung / Nummerierung @@ -892,7 +897,10 @@ void SwWW8ImplReader::Read_ANLevelDesc( USHORT, const BYTE* pData, short nLen ) SwNumRule* pNR = GetStyRule(); SetAnld(pNR, (WW8_ANLD*)pData, 0, false); pAktColl->SetFmtAttr( SwNumRuleItem( pNR->GetName() ) ); - pCollA[nAktColl].bHasStyNumRule = true; + + SwWW8StyInf * pStyInf = GetStyle(nAktColl); + if (pStyInf != NULL) + pStyInf->bHasStyNumRule = true; } } @@ -1007,9 +1015,10 @@ void SwWW8ImplReader::StartAnl(const BYTE* pSprm13) } } - if (!sNumRule.Len() && pCollA[nAktColl].bHasStyNumRule) + SwWW8StyInf * pStyInf = GetStyle(nAktColl); + if (!sNumRule.Len() && pStyInf->bHasStyNumRule) { - sNumRule = pCollA[nAktColl].pFmt->GetNumRule().GetValue(); + sNumRule = pStyInf->pFmt->GetNumRule().GetValue(); pNumRule = rDoc.FindNumRulePtr(sNumRule); if (!pNumRule) sNumRule.Erase(); @@ -3918,8 +3927,8 @@ WW8RStyle::WW8RStyle(WW8Fib& _rFib, SwWW8ImplReader* pI) : WW8Style(*pI->pTableStream, _rFib), maSprmParser(_rFib.GetFIBVersion()), pIo(pI), pStStrm(pI->pTableStream), pStyRule(0), nWwNumLevel(0) { - pIo->pCollA = new SwWW8StyInf[ cstd ]; // Style-UEbersetzung WW->SW pIo->nColls = cstd; + pIo->pCollA = cstd ? new SwWW8StyInf[ cstd ] : NULL; // Style-UEbersetzung WW->SW } void WW8RStyle::Set1StyleDefaults() @@ -4691,7 +4700,7 @@ void WW8RStyle::Import() // // fuer z.B. Tabellen wird ein immer gueltiger Std-Style gebraucht - if( pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid ) + if( pIo->StyleExists(0) && pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid ) pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->pCollA[0].pFmt; else pIo->pDfltTxtFmtColl = pIo->rDoc.GetDfltTxtFmtColl(); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index f20c13889f27..0f3acfaabb4e 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2281,22 +2281,48 @@ WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct, void WW8PLCF::ReadPLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF ) { + bool failure = false; + // Pointer auf Pos-Array pPLCF_PosArray = new WW8_CP[ ( nPLCF + 3 ) / 4 ]; sal_Size nOldPos = pSt->Tell(); pSt->Seek( nFilePos ); - pSt->Read( pPLCF_PosArray, nPLCF ); + failure = pSt->GetError(); + + if (!failure) + { + pSt->Read( pPLCF_PosArray, nPLCF ); + failure = pSt->GetError(); + } + + if (!failure) + { #ifdef OSL_BIGENDIAN - for( nIdx = 0; nIdx <= nIMax; nIdx++ ) - pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] ); - nIdx = 0; + for( nIdx = 0; nIdx <= nIMax; nIdx++ ) + pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] ); + nIdx = 0; #endif // OSL_BIGENDIAN - // Pointer auf Inhalts-Array - pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1]; + // Pointer auf Inhalts-Array + pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1]; + } pSt->Seek( nOldPos ); + + ASSERT( !failure, "Document has corrupt PLCF, ignoring it" ); + + if (failure) + MakeFailedPLCF(); +} + +void WW8PLCF::MakeFailedPLCF() +{ + nIMax = 0; + delete[] pPLCF_PosArray; + pPLCF_PosArray = new INT32[2]; + pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX; + pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1]; } void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN ) @@ -2359,13 +2385,7 @@ void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN ) ASSERT( !failure, "Document has corrupt PLCF, ignoring it" ); if (failure) - { - nIMax = 0; - delete[] pPLCF_PosArray; - pPLCF_PosArray = new INT32[2]; - pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX; - pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1]; - } + MakeFailedPLCF(); } bool WW8PLCF::SeekPos(WW8_CP nPos) @@ -6240,8 +6260,11 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) rSt.Seek( rFib.fcSttbfffn ); + INT32 nFFn = rFib.lcbSttbfffn - 2; + // allocate Font Array - BYTE* pA = new BYTE[ rFib.lcbSttbfffn - 2 ]; + BYTE* pA = new BYTE[ nFFn ]; + memset(pA, 0, nFFn); WW8_FFN* p = (WW8_FFN*)pA; ww::WordVersion eVersion = rFib.GetFIBVersion(); @@ -6258,13 +6281,13 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) rSt.SeekRel( 2 ); // read all font information - rSt.Read( pA, rFib.lcbSttbfffn - 2 ); + nFFn = rSt.Read( pA, nFFn ); if( eVersion < ww::eWW8 ) { // try to figure out how many fonts are defined here nMax = 0; - long nLeft = rFib.lcbSttbfffn - 2; + long nLeft = nFFn; for(;;) { short nNextSiz; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 3547eaf99391..85c80ba51025 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -295,6 +295,8 @@ private: machen wir uns hiermit einen PLC: */ void GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN ); + + void MakeFailedPLCF(); public: WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct, WW8_CP nStartPos = -1 ); -- cgit v1.2.3 From d8b779f2d3b99a845a391a25d43ccfa48c53b4f5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 4 Jan 2010 12:57:09 +0000 Subject: exchgcmtdoc2: #i98634#: export writer change-comment as normal msword comment --- sw/source/filter/ww8/wrtw8sty.cxx | 63 ++++++++++++++++++++++------- sw/source/filter/ww8/wrtww8.cxx | 6 +-- sw/source/filter/ww8/wrtww8.hxx | 28 +++++++++---- sw/source/filter/ww8/ww8atr.cxx | 22 +++++++++- sw/source/filter/ww8/ww8attributeoutput.hxx | 3 +- sw/source/filter/ww8/ww8par.cxx | 5 ++- sw/source/filter/ww8/ww8scan.cxx | 11 ++--- 7 files changed, 103 insertions(+), 35 deletions(-) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 70756840603c..8e6b0c77b878 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include @@ -1856,13 +1857,48 @@ void WW8_WrPlcFtnEdn::Append( WW8_CP nCp, const SwFmtFtn& rFtn ) aCntnt.Insert( p, aCntnt.Count() ); } -void WW8_WrPlcPostIt::Append( WW8_CP nCp, const SwPostItField& rPostIt ) +WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt) +{ + mpRichText = pPostIt->GetTextObject(); + if (!mpRichText) + msSimpleText = pPostIt->GetTxt(); + msOwner = pPostIt->GetPar1(); + maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime()); +} + +WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline) : mpRichText(0) +{ + msSimpleText = pRedline->GetComment(); + msOwner = SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()); + maDateTime = pRedline->GetTimeStamp(); +} + +void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt ) { aCps.Insert( nCp, aCps.Count() ); - void* p = (void*)&rPostIt; + WW8_Annotation* p = new WW8_Annotation(pPostIt); aCntnt.Insert( p, aCntnt.Count() ); } +void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwRedlineData *pRedline ) +{ + maProcessedRedlines.insert(pRedline); + aCps.Insert( nCp, aCps.Count() ); + WW8_Annotation* p = new WW8_Annotation(pRedline); + aCntnt.Insert( p, aCntnt.Count() ); +} + +bool WW8_WrPlcAnnotations::IsNewRedlineComment( const SwRedlineData *pRedline ) +{ + return maProcessedRedlines.find(pRedline) == maProcessedRedlines.end(); +} + +WW8_WrPlcAnnotations::~WW8_WrPlcAnnotations() +{ + for( USHORT n=0; n < aCntnt.Count(); n++ ) + delete (WW8_Annotation*)aCntnt[n]; +} + bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp, WW8_CP& rCount ) { @@ -1882,13 +1918,13 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp, // Anfaenge fuer PlcfAtnTxt pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() )); - const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ]; rWrt.WritePostItBegin(); - if (const OutlinerParaObject* pOutliner = rPFld.GetTextObject()) - rWrt.WriteOutliner(*pOutliner, nTTyp); + const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i]; + if (rAtn.mpRichText) + rWrt.WriteOutliner(*rAtn.mpRichText, nTTyp); else { - String sTxt(rPFld.GetTxt()); + String sTxt(rAtn.msSimpleText); sTxt.SearchAndReplaceAll(0x0A, 0x0B); rWrt.WriteStringAsPara( sTxt ); } @@ -2015,8 +2051,8 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, // then write first the GrpXstAtnOwners for ( i = 0; i < nLen; ++i ) { - const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ]; - aStrArr.push_back(rPFld.GetPar1()); + const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i]; + aStrArr.push_back(rAtn.msOwner); } //sort and remove duplicates @@ -2054,10 +2090,9 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, { for( i = 0; i < nLen; ++i ) { - const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ]; + const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i]; - sal_uInt32 nDTTM = - sw::ms::DateTime2DTTM(DateTime(rPFld.GetDate(),rPFld.GetTime())); + sal_uInt32 nDTTM = sw::ms::DateTime2DTTM(rAtn.maDateTime); SwWW8Writer::WriteLong( *rWrt.pTableStrm, nDTTM ); SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); @@ -2137,12 +2172,12 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, { for ( i = 0; i < nLen; ++i ) { - const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ]; + const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i]; //aStrArr is sorted myiter aIter = ::std::lower_bound(aStrArr.begin(), - aStrArr.end(), rPFld.GetPar1()); - ASSERT(aIter != aStrArr.end() && *aIter == rPFld.GetPar1(), + aStrArr.end(), rAtn.msOwner); + ASSERT(aIter != aStrArr.end() && *aIter == rAtn.msOwner, "Impossible"); sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin()); String sAuthor(*aIter); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index fb121eb322f7..fb5ce68ec654 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3039,7 +3039,7 @@ void WW8Export::ExportDocument_Impl() pFtn = new WW8_WrPlcFtnEdn( TXT_FTN ); // Footnotes pEdn = new WW8_WrPlcFtnEdn( TXT_EDN ); // Endnotes - pAtn = new WW8_WrPlcPostIt; // PostIts + pAtn = new WW8_WrPlcAnnotations; // PostIts pTxtBxs = new WW8_WrPlcTxtBoxes( TXT_TXTBOX ); pHFTxtBxs = new WW8_WrPlcTxtBoxes( TXT_HFTXTBOX ); @@ -3448,7 +3448,7 @@ void WW8_WrPlcFtnEdn::WritePlc( WW8Export& rWrt ) const } -bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt ) +bool WW8_WrPlcAnnotations::WriteTxt( WW8Export& rWrt ) { bool bRet = WriteGenericTxt( rWrt, TXT_ATN, rWrt.pFib->ccpAtn ); rWrt.pFldAtn->Finish( rWrt.Fc2Cp( rWrt.Strm().Tell() ), @@ -3457,7 +3457,7 @@ bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt ) return bRet; } -void WW8_WrPlcPostIt::WritePlc( WW8Export& rWrt ) const +void WW8_WrPlcAnnotations::WritePlc( WW8Export& rWrt ) const { WriteGenericPlc( rWrt, TXT_ATN, rWrt.pFib->fcPlcfandTxt, rWrt.pFib->lcbPlcfandTxt, rWrt.pFib->fcPlcfandRef, diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 2e0b4ab7d778..83b3b7b265ed 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -109,7 +109,7 @@ class WW8_WrPlcFld; class WW8_WrMagicTable; class WW8_WrPlcFtnEdn; class WW8_WrPlcPn; -class WW8_WrPlcPostIt; +class WW8_WrPlcAnnotations; class MSWordSections; class WW8_WrPlcTxtBoxes; class WW8_WrPct; // Verwaltung @@ -488,7 +488,7 @@ public: WW8_WrPlcPn* pChpPlc; MSWordAttrIter* pChpIter; MSWordStyles* pStyles; - WW8_WrPlcPostIt* pAtn; + WW8_WrPlcAnnotations* pAtn; WW8_WrPlcTxtBoxes *pTxtBxs, *pHFTxtBxs; const sw::Frame *mpParentFrame; //If set we are exporting content inside @@ -1149,16 +1149,30 @@ public: void Append( WW8_CP nCp, const SwFmtFtn& rFtn ); }; -class WW8_WrPlcPostIt : public WW8_WrPlcSubDoc // Doppel-Plc fuer PostIts +struct WW8_Annotation +{ + const OutlinerParaObject* mpRichText; + String msSimpleText; + String msOwner; + DateTime maDateTime; + WW8_Annotation(const SwPostItField* pPostIt); + WW8_Annotation(const SwRedlineData* pRedline); +}; + +class WW8_WrPlcAnnotations : public WW8_WrPlcSubDoc // Doppel-Plc fuer PostIts { private: //No copying - WW8_WrPlcPostIt(const WW8_WrPlcPostIt&); - WW8_WrPlcPostIt& operator=(WW8_WrPlcPostIt&); + WW8_WrPlcAnnotations(const WW8_WrPlcAnnotations&); + WW8_WrPlcAnnotations& operator=(WW8_WrPlcAnnotations&); + std::set maProcessedRedlines; public: - WW8_WrPlcPostIt() {} + WW8_WrPlcAnnotations() {} + ~WW8_WrPlcAnnotations(); - void Append( WW8_CP nCp, const SwPostItField& rPostIt ); + void Append( WW8_CP nCp, const SwPostItField* pPostIt ); + void Append( WW8_CP nCp, const SwRedlineData* pRedLine ); + bool IsNewRedlineComment( const SwRedlineData* pRedLine ); bool WriteTxt( WW8Export& rWrt ); void WritePlc( WW8Export& rWrt ) const; }; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 54ebd5c5a9ba..b20df77e79a1 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -982,6 +982,24 @@ void WW8AttributeOutput::StartRunProperties() m_nFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0; } + +void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +{ + if (pRedlineData) + { + const String &rComment = pRedlineData->GetComment(); + //Only possible to export to main text + if (rComment.Len() && (m_rWW8Export.nTxtTyp == TXT_MAINTEXT)) + { + if (m_rWW8Export.pAtn->IsNewRedlineComment(pRedlineData)) + { + m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pRedlineData ); + m_rWW8Export.WritePostItBegin( m_rWW8Export.pO ); + } + } + } +} + void WW8AttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData ) { Redline( pRedlineData ); @@ -2555,8 +2573,8 @@ void WW8AttributeOutput::SetField( const SwField& rFld, ww::eField eType, const void WW8AttributeOutput::PostitField( const SwField* pFld ) { - const SwPostItField& rPFld = *(SwPostItField*)pFld; - m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rPFld ); + const SwPostItField *pPFld = (const SwPostItField*)pFld; + m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pPFld ); m_rWW8Export.WritePostItBegin( m_rWW8Export.pO ); } diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 4968d88887dc..8d8516433432 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -57,8 +57,7 @@ public: /// Start of the text run. /// - /// No-op for binary filters. - virtual void StartRun( const SwRedlineData* /*pRedlineData*/ ) {} + virtual void StartRun( const SwRedlineData* pRedlineData ); /// End of the text run. /// diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b92f80c85290..cf6c4ebb008e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -57,9 +57,8 @@ #include // SvxLRSpaceItem #include #include -// --> OD 2005-02-28 #i43427# #include -// <-- +#include #include #include #include @@ -1630,7 +1629,9 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) sTxt, aDate ); aPostIt.SetTextObject(pOutliner); + pCtrlStck->NewAttr(*pPaM->GetPoint(), SvxCharHiddenItem(false, RES_CHRATR_HIDDEN)); rDoc.InsertPoolItem(*pPaM, SwFmtFld(aPostIt), 0); + pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_HIDDEN); return 0; } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index f20c13889f27..726e48c314bc 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -4390,15 +4390,16 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp, pBkm = &aD[1]; pEdn = &aD[2]; pFtn = &aD[3]; + pAnd = &aD[4]; - - pPcd = ( pBase->pPLCFx_PCD ) ? &aD[4] : 0; + pPcd = ( pBase->pPLCFx_PCD ) ? &aD[5] : 0; //pPcdA index == pPcd index + 1 - pPcdA = ( pBase->pPLCFx_PCDAttrs ) ? &aD[5] : 0; - pChp = &aD[6]; - pAnd = &aD[7]; + pPcdA = ( pBase->pPLCFx_PCDAttrs ) ? &aD[6] : 0; + + pChp = &aD[7]; pPap = &aD[8]; pSep = &aD[9]; + pSep->pPLCFx = pBase->pSepPLCF; pFtn->pPLCFx = pBase->pFtnPLCF; pEdn->pPLCFx = pBase->pEdnPLCF; -- cgit v1.2.3 From 680ebbec1520b6df42264a450932d779edc07c3c Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 13 Jan 2010 10:16:37 +0100 Subject: #i108219# SwWeb print options fixed --- sw/source/core/view/vprint.cxx | 23 +++++++++++++---------- sw/source/ui/config/optpage.cxx | 19 ++++++++++++++++--- sw/source/ui/config/prtopt.cxx | 18 ++++++++++++++++-- 3 files changed, 45 insertions(+), 15 deletions(-) mode change 100644 => 100755 sw/source/ui/config/optpage.cxx diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index bab2428c0b67..864948046b75 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -394,7 +394,7 @@ SwPrintUIOptions::SwPrintUIOptions( // create sequence of print UI options // (5 options are not available for Writer-Web) const int nCTLOpts = bCTL ? 1 : 0; - const int nNumProps = nCTLOpts + (bWeb ? 16 : 20); + const int nNumProps = nCTLOpts + (bWeb ? 14 : 20); m_aUIProperties.realloc( nNumProps ); int nIdx = 0; @@ -455,15 +455,18 @@ SwPrintUIOptions::SwPrintUIOptions( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), bDefaultVal ); - // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); - - // create a bool option for printing automatically inserted blank pages - bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), - aLocalizedStrings.GetString( 17 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - bDefaultVal ); + if (!bWeb) + { + // create subgroup for misc options + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); + + // create a bool option for printing automatically inserted blank pages + bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), + aLocalizedStrings.GetString( 17 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + bDefaultVal ); + } // create a bool option for paper tray bDefaultVal = rDefaultPrintData.IsPaperFromSetup(); diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx old mode 100644 new mode 100755 index d609f1ed28cc..0777ac3c3325 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -416,13 +416,26 @@ SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, aPrintTextPlaceholderCB.Hide(); // aReverseCB.SetPosPixel(aLeftPageCB.GetPosPixel()); aProspectCB.SetPosPixel(aLeftPageCB.GetPosPixel()); - Point rPt( aRightPageCB.GetPosPixel() ); - rPt.setX(rPt.getX() + 15); // indent - aProspectCB_RTL.SetPosPixel(rPt); + Point aPt( aRightPageCB.GetPosPixel() ); + aPt.setX(aPt.getX() + 15); // indent + aProspectCB_RTL.SetPosPixel(aPt); // aBlackFontCB.SetPosPixel(aBackgroundCB.GetPosPixel()); // aPrintHiddenTextCB.SetPosPixel(aBlackFontCB.GetPosPixel()); // aBackgroundCB.SetPosPixel(aCtrlFldCB.GetPosPixel()); // aCtrlFldCB.SetPosPixel(aDrawCB.GetPosPixel()); + + // hide aPrintEmptyPagesCB and move everything below up accordingly + long nDeltaY = aPaperFromSetupCB.GetPosPixel().getY() - aPrintEmptyPagesCB.GetPosPixel().getY(); + aPrintEmptyPagesCB.Hide(); + aPt = aPaperFromSetupCB.GetPosPixel(); + aPt.setY( aPt.getY() - nDeltaY ); + aPaperFromSetupCB.SetPosPixel( aPt ); + aPt = aFaxFT.GetPosPixel(); + aPt.setY( aPt.getY() - nDeltaY ); + aFaxFT.SetPosPixel( aPt ); + aPt = aFaxLB.GetPosPixel(); + aPt.setY( aPt.getY() - nDeltaY ); + aFaxLB.SetPosPixel( aPt ); } aProspectCB_RTL.Disable(); SvtCTLOptions aCTLOptions; diff --git a/sw/source/ui/config/prtopt.cxx b/sw/source/ui/config/prtopt.cxx index ceb48b6adefe..1f8f04f54d65 100644 --- a/sw/source/ui/config/prtopt.cxx +++ b/sw/source/ui/config/prtopt.cxx @@ -69,8 +69,8 @@ Sequence SwPrintOptions::GetPropertyNames() "Page/LeftPage", // 13 not in SW/Web "Page/RightPage", // 14 not in SW/Web "EmptyPages", // 15 not in SW/Web - "Content/PrintPlaceholders", // 16 not in Sw/Web - "Content/PrintHiddenText" // 17 + "Content/PrintPlaceholders", // 16 not in Sw/Web + "Content/PrintHiddenText" // 17 not in Sw/Web }; const int nCount = bIsWeb ? 12 : 18; Sequence aNames(nCount); @@ -92,6 +92,8 @@ SwPrintOptions::SwPrintOptions(sal_Bool bWeb) : bPrintPageBackground = !bWeb; bPrintBlackFont = bWeb; bPrintTextPlaceholder = bPrintHiddenText = sal_False; + if (bWeb) + bPrintEmptyPages = sal_False; Sequence aNames = GetPropertyNames(); Sequence aValues = GetProperties(aNames); @@ -133,6 +135,12 @@ SwPrintOptions::SwPrintOptions(sal_Bool bWeb) : } } } + + // currently there is just one checkbox for print drawings and print graphics + // In the UI. (File/Print dialog and Tools/Options/.../Print) + // And since print graphics is the only available in Writer and WrtierWeb ... + + bPrintDraw = bPrintGraphic; } /* -----------------------------06.09.00 16:50-------------------------------- @@ -176,6 +184,12 @@ void SwPrintOptions::Commit() case 17: bVal = bPrintHiddenText; pValues[nProp].setValue(&bVal, rType); break; } } + + // currently there is just one checkbox for print drawings and print graphics + // In the UI. (File/Print dialog and Tools/Options/.../Print) + // And since print graphics is the only available in Writer and WrtierWeb ... + bPrintDraw = bPrintGraphic; + PutProperties(aNames, aValues); } -- cgit v1.2.3 From b59c89d2ae495e0c42ae76042379960444269b19 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 14 Jan 2010 22:27:44 +0100 Subject: undo previous erroneous change, solar.hrc belongs to svl instead vcl now --- starmath/inc/starmath.hrc | 2 +- starmath/source/math_pch.cxx | 2 +- sw/inc/helpid.h | 2 +- sw/inc/pch/precompiled_sw.hxx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index ea9f2cd793f6..96f405ed7e8e 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -31,7 +31,7 @@ #define _STARMATH_HRC #ifndef _SVX_SVXIDS_HRC -#include +#include #endif #ifndef _SFXSIDS_HRC //autogen #include diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx index 44e683306f05..6dba5ec80379 100644 --- a/starmath/source/math_pch.cxx +++ b/starmath/source/math_pch.cxx @@ -131,7 +131,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index dca700fbb8b6..6bab531ad1c5 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -28,7 +28,7 @@ * ************************************************************************/ #ifndef _SOLAR_HRC -#include +#include #endif #define HID_BASE HID_APP_START diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index f43d09731f2f..e8aadd472aa6 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -677,7 +677,7 @@ #include "svl/slstitm.hxx" #include "svl/smplhint.hxx" #include "svtools/soerr.hxx" -#include "vcl/solar.hrc" +#include "svl/solar.hrc" #include "unotools/sourceviewconfig.hxx" #include "svtools/stdctrl.hxx" #include "svl/stritem.hxx" -- cgit v1.2.3 From 5390c9fba7b59dda8f1a2a00e9535a52098d04e0 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 15 Jan 2010 00:20:57 +0100 Subject: solve some merge problems --- starmath/source/unomodel.cxx | 2 +- sw/source/core/view/vprint.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index eadf909cfc64..6694d42ad913 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 94169b0db2ab..10b62f92c68a 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -54,8 +54,8 @@ #include #include -#include -#include +#include +#include #include #include -- cgit v1.2.3 From df7c98db5ee7ed1e910d3e96461da37c005fa263 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 18 Jan 2010 18:37:54 +0100 Subject: masterfix: #i10000# bBoolVar does not exist, use rValue --- sw/source/ui/uno/unomod.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx index 6a072b44af31..906402b8e365 100644 --- a/sw/source/ui/uno/unomod.cxx +++ b/sw/source/ui/uno/unomod.cxx @@ -572,17 +572,17 @@ void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, break; case HANDLE_PRINTSET_PROSPECT_RTL: { - bBoolVal = mpPrtOpt->IsPrintProspectRTL(); + rValue <<= mpPrtOpt->IsPrintProspectRTL(); } break; case HANDLE_PRINTSET_PLACEHOLDER: { - bBoolVal = mpPrtOpt->IsPrintTextPlaceholder(); + rValue <<= mpPrtOpt->IsPrintTextPlaceholder(); } break; case HANDLE_PRINTSET_HIDDEN_TEXT: { - bBoolVal = mpPrtOpt->IsPrintHiddenText(); + rValue <<= mpPrtOpt->IsPrintHiddenText(); } break; default: -- cgit v1.2.3 From fdde737ea0caf7450a6676f46651f78ee05321ab Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 18 Jan 2010 19:01:17 +0100 Subject: masterfix: #i10000# syntax error fixed --- sw/source/core/view/vprint.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 10b62f92c68a..7a22698b87ca 100755 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -562,7 +562,7 @@ SwPrintUIOptions::SwPrintUIOptions( // 0 : all pages (left & right) // 1 : left pages // 2 : right pages - DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRigthPage(), + DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(), "unexpected value combination" ); sal_Int16 nPagesChoice = 0; if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage()) -- cgit v1.2.3