summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-01-15 16:47:42 +0100
committerKurt Zenker <kz@openoffice.org>2010-01-15 16:47:42 +0100
commit4563270cfd37f1a08e0315a5624affa3a7680771 (patch)
tree1b82b3b7fb3d35f3ee1a1de38db287810bfb91cb /starmath
parentdeac05f7518a25ecde94454fbc21adef0de92682 (diff)
parent5390c9fba7b59dda8f1a2a00e9535a52098d04e0 (diff)
CWS-TOOLING: integrate CWS printerpullpages
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/document.hxx5
-rw-r--r--starmath/inc/starmath.hrc2
-rw-r--r--starmath/inc/unomodel.hxx23
-rw-r--r--starmath/inc/view.hxx5
-rw-r--r--starmath/source/document.cxx11
-rw-r--r--starmath/source/smres.src257
-rw-r--r--starmath/source/unomodel.cxx149
-rw-r--r--starmath/source/view.cxx71
-rw-r--r--starmath/util/makefile.mk1
9 files changed, 245 insertions, 279 deletions
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 94bffbaad48d..210f2022b760 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -38,11 +38,10 @@
#include <svl/lstner.hxx>
#include <sfx2/docfac.hxx>
#include <vcl/virdev.hxx>
+
#include "format.hxx"
#include "parse.hxx"
-#ifndef SMMOD_HXX
#include "smmod.hxx"
-#endif
#include <vcl/jobset.hxx>
@@ -84,6 +83,8 @@ class Printer;
class SmDocShell;
class EditEngine;
+////////////////////////////////////////////////////////////
+
class SmPrinterAccess
{
Printer* pPrinter;
diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc
index 0f93e6551cc9..96f405ed7e8e 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 50cdc372d593..f05c4beec7ae 100644
--- a/starmath/inc/unomodel.hxx
+++ b/starmath/inc/unomodel.hxx
@@ -35,11 +35,30 @@
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/view/XRenderable.hpp>
+
#include <sfx2/sfxbasemodel.hxx>
#include <comphelper/propertysethelper.hxx>
+#include <vcl/print.hxx>
class SmFormat;
+////////////////////////////////////////////////////////////
+
+#define PRTUIOPT_TITLE_ROW "TitleRow"
+#define PRTUIOPT_FORMULA_TEXT "FormulaText"
+#define PRTUIOPT_BORDER "Border"
+#define PRTUIOPT_PRINT_FORMAT "PrintFormat"
+#define PRTUIOPT_PRINT_SCALE "PrintScale"
+
+class SmPrintUIOptions : public vcl::PrinterOptionsHelper
+{
+public:
+ SmPrintUIOptions();
+};
+
+
+////////////////////////////////////////////////////////////
+
#define A2OU(pText) rtl::OUString::createFromAscii(pText)
//-----------------------------------------------------------------------------
@@ -48,6 +67,7 @@ class SmModel : public SfxBaseModel,
public com::sun::star::lang::XServiceInfo,
public com::sun::star::view::XRenderable
{
+ 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 );
@@ -86,4 +106,7 @@ public:
static ::rtl::OUString getImplementationName_Static();
};
+////////////////////////////////////////////////////////////
+
#endif
+
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 8c89d9517898..3aaa9455baf6 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;
/**************************************************************************/
@@ -292,8 +293,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 b9064a78a5f5..81d137fa122f 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -111,17 +111,12 @@ using namespace ::com::sun::star::uno;
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/smres.src b/starmath/source/smres.src
index eee43aace130..47f51fe18c04 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 */
};
};
};
@@ -3580,189 +3580,28 @@ String RID_MATH_TOOLBOX
Text [ en-US ] = "Main Toolbar" ;
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+StringArray RID_PRINTUIOPTIONS
+{
+ ItemList [en-US] =
+ {
+ < "%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~orders"; >;
+ < "Applies a thin border to the formula area in the printout."; >;
+ < "Size"; >;
+ < "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 6a4a65b7e228..6694d42ad913 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -42,6 +42,7 @@
#include <unotools/processfactory.hxx>
#include <svx/paperinf.hxx>
#include <vcl/settings.hxx>
+#include <vcl/print.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -51,15 +52,14 @@
#include <xmloff/xmluconv.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/propertysetinfo.hxx>
+#include <unotools/moduleoptions.hxx>
+
#include <unomodel.hxx>
#include <document.hxx>
#include <view.hxx>
#include <symbol.hxx>
-#ifndef STARMATH_HRC
#include <starmath.hrc>
-#endif
#include <config.hxx>
-
#include <smdll.hxx>
using namespace ::vos;
@@ -75,11 +75,102 @@ 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))
+////////////////////////////////////////////////////////////
-////////////////////////////////////////
+SmPrintUIOptions::SmPrintUIOptions()
+{
+ ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) );
+ DBG_ASSERT( aLocalizedStrings.Count() >= 18, "resource incomplete" );
+ if( aLocalizedStrings.Count() < 18 ) // 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
+ // (Actually IsIgnoreSpacesRight is a parser option. Without it we need only 8 properties here.)
+ m_aUIProperties.realloc( 9 );
+
+ // create Section for formula (results in an extra tab page in dialog)
+ SvtModuleOptions aOpt;
+ 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() );
+
+ // create subgroup for print options
+ 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( 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( 6 ),
+ aLocalizedStrings.GetString( 7 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRTUIOPT_BORDER ) ),
+ pConfig->IsPrintFrame() );
+
+ // create subgroup for print format
+ 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( 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)
+ 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
+ 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.
+//
+// // 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() );
+}
+
+
+////////////////////////////////////////////////////////////
//
// class SmModel
//
@@ -229,11 +320,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---------------------------------------------------
@@ -862,10 +956,33 @@ sal_Int32 SAL_CALL SmModel::getRendererCount(
return 1;
}
+
+static Size lcl_GuessPaperSize()
+{
+ Size aRes;
+ Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
+ LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() );
+ if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() )
+ {
+ // in 100th mm
+ PaperInfo aInfo( PAPER_A4 );
+ aRes.Width() = aInfo.getWidth();
+ aRes.Height() = aInfo.getHeight();
+ }
+ else
+ {
+ // in 100th mm
+ PaperInfo aInfo( PAPER_LETTER );
+ aRes.Width() = aInfo.getWidth();
+ aRes.Height() = aInfo.getHeight();
+ }
+ return aRes;
+}
+
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());
@@ -885,7 +1002,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
// 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);
+ aPrtPaperSize = lcl_GuessPaperSize();
awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
uno::Sequence< beans::PropertyValue > aRenderer(1);
@@ -893,6 +1010,10 @@ 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;
}
@@ -954,7 +1075,7 @@ void SAL_CALL SmModel::render(
// no real printer ??
if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0)
{
- aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MAP_100TH_MM);
+ aPrtPaperSize = lcl_GuessPaperSize();
// factors from Windows DIN A4
aOutputSize = Size( (long)(aPrtPaperSize.Width() * 0.941),
(long)(aPrtPaperSize.Height() * 0.961));
@@ -979,8 +1100,18 @@ void SAL_CALL SmModel::render(
OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() -
(aPrtPageOffset.X() + OutputRect.Right()));
- pView->Impl_Print( *pOut, PRINT_SIZE_NORMAL,
- Rectangle( OutputRect ), Point() );
+ 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( "IsLastPage", sal_False ))
+ {
+ delete m_pPrintUIOptions; m_pPrintUIOptions = 0;
+ }
}
}
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 855831fc9e9f..288018596643 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -69,6 +69,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/wrkwin.hxx>
+#include "unomodel.hxx"
#include "view.hxx"
#include "config.hxx"
#include "dialog.hxx"
@@ -89,8 +90,6 @@
#define SmViewShell
#include "smslots.hxx"
-
-
using namespace com::sun::star;
using namespace com::sun::star::accessibility;
using namespace com::sun::star::uno;
@@ -1010,18 +1009,25 @@ 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( 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( 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);
@@ -1041,7 +1047,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;
@@ -1068,11 +1074,9 @@ void SmViewShell::Impl_Print(
}
// output text on bottom
- if (pp->GetConfig()->IsPrintFormulaText())
+ if (bIsPrintFormulaText)
{
-// Font aFont(FAMILY_DONTKNOW, Size(0, 600));
- Font aFont;
-
+ Font aFont(FAMILY_DONTKNOW, Size(0, 600));
aFont.SetAlign(ALIGN_TOP);
aFont.SetColor( Color(COL_BLACK) );
@@ -1083,7 +1087,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)));
@@ -1094,7 +1098,7 @@ void SmViewShell::Impl_Print(
aOutRect.Bottom() -= 200;
}
- if (pp->GetConfig()->IsPrintFrame())
+ if (bIsPrintFrame)
rOutDev.DrawRect(aOutRect);
aOutRect.Top() += 100;
@@ -1105,6 +1109,9 @@ void SmViewShell::Impl_Print(
Size aSize (GetDoc()->GetSize());
MapMode OutputMapMode;
+ // PDF export should always use PRINT_SIZE_NORMAL ...
+ if (!rPrintUIOptions.getBoolValue( "IsPrinter", sal_False ) )
+ ePrintSize = PRINT_SIZE_NORMAL;
switch (ePrintSize)
{
case PRINT_SIZE_NORMAL:
@@ -1129,7 +1136,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;
@@ -1155,44 +1162,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;
}
diff --git a/starmath/util/makefile.mk b/starmath/util/makefile.mk
index 978cb6cff40c..0e11dc46aa24 100644
--- a/starmath/util/makefile.mk
+++ b/starmath/util/makefile.mk
@@ -65,6 +65,7 @@ SHL1STDLIBS= \
$(TKLIB) \
$(VCLLIB) \
$(SVLLIB) \
+ $(I18NPAPERLIB) \
$(SOTLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \