summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-01-14 19:11:13 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-01-14 19:11:13 +0100
commit7d3f9d117854eecde1f6627cc1656353be46a7ca (patch)
treef90344f1fe8dfd968f40882ed4b356c59fc29b9c /starmath
parent680ebbec1520b6df42264a450932d779edc07c3c (diff)
parent3a66e8444c9086c53a27159a1a0edad3b6e85ff5 (diff)
rebase to DEV300_m69
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/action.hxx2
-rw-r--r--starmath/inc/config.hxx4
-rw-r--r--starmath/inc/document.hxx2
-rw-r--r--starmath/inc/format.hxx4
-rw-r--r--starmath/inc/smmod.hxx9
-rw-r--r--starmath/inc/symbol.hxx4
-rw-r--r--starmath/sdi/makefile.mk10
-rw-r--r--starmath/sdi/smitems.sdi (renamed from starmath/sdi/svxitems.sdi)0
-rw-r--r--starmath/sdi/smslots.sdi16
-rw-r--r--starmath/source/accessibility.cxx2
-rw-r--r--starmath/source/accessibility.hxx2
-rw-r--r--starmath/source/cfgitem.cxx2
-rw-r--r--starmath/source/cfgitem.hxx4
-rw-r--r--starmath/source/config.cxx16
-rw-r--r--starmath/source/dialog.cxx18
-rw-r--r--starmath/source/document.cxx30
-rw-r--r--starmath/source/edit.cxx8
-rw-r--r--starmath/source/math_pch.cxx34
-rw-r--r--starmath/source/mathmlexport.cxx24
-rw-r--r--starmath/source/mathmlimport.cxx140
-rw-r--r--starmath/source/parse.cxx2
-rw-r--r--starmath/source/smdetect.cxx6
-rw-r--r--starmath/source/smmod.cxx17
-rw-r--r--starmath/source/toolbox.cxx6
-rw-r--r--starmath/source/typemap.cxx6
-rw-r--r--starmath/source/unomodel.cxx2270
-rw-r--r--starmath/source/view.cxx18
27 files changed, 1331 insertions, 1325 deletions
diff --git a/starmath/inc/action.hxx b/starmath/inc/action.hxx
index 6e2375331de9..6a816a447d8c 100644
--- a/starmath/inc/action.hxx
+++ b/starmath/inc/action.hxx
@@ -30,7 +30,7 @@
#ifndef ACTION_HXX
#define ACTION_HXX
-#include <svtools/undo.hxx>
+#include <svl/undo.hxx>
#include "format.hxx"
class SmDocShell;
diff --git a/starmath/inc/config.hxx b/starmath/inc/config.hxx
index 6528c81b45ac..ecf30b244f80 100644
--- a/starmath/inc/config.hxx
+++ b/starmath/inc/config.hxx
@@ -30,8 +30,8 @@
#ifndef CONFIG_HXX
#define CONFIG_HXX
-#include <svtools/brdcst.hxx>
-#include <svtools/lstner.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
#include "format.hxx"
#include "cfgitem.hxx"
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 597b6691ccbe..210f2022b760 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -35,7 +35,7 @@
#include <sot/storage.hxx>
#include <sot/sotref.hxx>
#include <sfx2/objsh.hxx>
-#include <svtools/lstner.hxx>
+#include <svl/lstner.hxx>
#include <sfx2/docfac.hxx>
#include <vcl/virdev.hxx>
diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx
index 05375f8a73e0..6b9b5ad650b5 100644
--- a/starmath/inc/format.hxx
+++ b/starmath/inc/format.hxx
@@ -31,8 +31,8 @@
#define FORMAT_HXX
-#include <svtools/smplhint.hxx>
-#include <svtools/brdcst.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/brdcst.hxx>
#include "utility.hxx"
#include <types.hxx>
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index 4b493c0cbca7..722efd82595c 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -34,7 +34,7 @@
#ifndef _SV_RESARY_HXX
#include <tools/resary.hxx>
#endif
-#include <svtools/lstner.hxx>
+#include <svl/lstner.hxx>
#include <svtools/colorcfg.hxx>
#include <tools/shl.hxx>
@@ -44,6 +44,8 @@
#include "starmath.hrc"
#endif
+#include <unotools/options.hxx>
+
class SvxErrorHandler;
class SfxObjectFactory;
class SmConfig;
@@ -124,7 +126,7 @@ public:
/////////////////////////////////////////////////////////////////
-class SmModule : public SfxModule, public SfxListener
+class SmModule : public SfxModule, utl::ConfigurationListener
{
svtools::ColorConfig *pColorConfig;
SmConfig *pConfig;
@@ -145,8 +147,7 @@ public:
SmModule(SfxObjectFactory* pObjFact);
virtual ~SmModule();
- // SfxListener
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
svtools::ColorConfig & GetColorConfig();
diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx
index d39376c30ed0..9d0707a19690 100644
--- a/starmath/inc/symbol.hxx
+++ b/starmath/inc/symbol.hxx
@@ -37,8 +37,8 @@
#include <tools/list.hxx>
#include <tools/debug.hxx>
#include <tools/dynary.hxx>
-#include <svtools/lstner.hxx>
-#include <svtools/svarray.hxx>
+#include <svl/lstner.hxx>
+#include <svl/svarray.hxx>
#include "utility.hxx"
#include <smmod.hxx>
diff --git a/starmath/sdi/makefile.mk b/starmath/sdi/makefile.mk
index 768280af9747..f868756f5990 100644
--- a/starmath/sdi/makefile.mk
+++ b/starmath/sdi/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -46,8 +46,12 @@ SVSDIINC=$(PRJ)$/inc
SDI1NAME=$(TARGET)
SVSDI1DEPEND= \
- $(SOLARINCDIR)$/svxslots.ilb \
- smath.sdi \
+ $(SOLARINCXDIR)$/sfx2/sfx.sdi \
+ $(SOLARINCXDIR)$/sfx2/sfxitems.sdi \
+ $(SOLARINCXDIR)$/svx/svx.sdi \
+ $(SOLARINCXDIR)$/svx/svxitems.sdi \
+ $(SOLARINCXDIR)$/svx/xoitems.sdi \
+ smath.sdi \
smslots.sdi \
$(SVSDIINC)$/starmath.hrc
diff --git a/starmath/sdi/svxitems.sdi b/starmath/sdi/smitems.sdi
index ddbf0f2fc185..ddbf0f2fc185 100644
--- a/starmath/sdi/svxitems.sdi
+++ b/starmath/sdi/smitems.sdi
diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi
index 40b9da78d7ff..88bd108bddff 100644
--- a/starmath/sdi/smslots.sdi
+++ b/starmath/sdi/smslots.sdi
@@ -28,8 +28,6 @@
*
************************************************************************/
-import "svxslots.ilb"
-
module
"312C4240-35E7-101C-B12A-04021C007002"
"58216740-35E7-101C-B12A-04021C007002"
@@ -39,9 +37,13 @@ StarMath
SlotIdFile ( "starmath.hrc" )
SlotIdFile ( "sfx2/sfxsids.hrc" )
SlotIdFile ( "svx/svxids.hrc" )
- TypeLibFile ( "smslots.tlb" )
]
{
+ include "sfx2/sfxitems.sdi"
+ include "sfx2/sfx.sdi"
+ include "svx/svxitems.sdi"
+ include "svx/xoitems.sdi"
+ include "svx/svx.sdi"
include "smath.sdi"
interface StarMath
[
@@ -59,7 +61,7 @@ shell SmModule
import StarMath[Automation];
}
-interface FormulaDocument : OfficeDocument
+interface FormulaDocument
[
uuid ( "815CBB20-2FC3-11CF-89CA-008029E4B0B1" )
]
@@ -149,13 +151,13 @@ interface FormulaDocument : OfficeDocument
]
}
-shell SmDocShell : SfxObjectShell
+shell SmDocShell
{
import FormulaDocument[Automation];
}
-interface FormulaView : View
+interface FormulaView
[
uuid ( "CE1A6C00-2FC3-11CF-89CA-008029E4B0B1" )
]
@@ -323,7 +325,7 @@ interface FormulaView : View
]
}
-shell SmViewShell : SfxViewShell
+shell SmViewShell
{
import FormulaView[Automation];
}
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index f258d7f31176..823e5bbd926e 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -51,7 +51,7 @@
#include <vcl/unohelp2.hxx>
#include <tools/gen.hxx>
#include <vos/mutex.hxx>
-#include <svtools/itemset.hxx>
+#include <svl/itemset.hxx>
#include <svx/editobj.hxx>
#include <svx/editdata.hxx>
diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx
index 7199583dd4ff..07217bee9f1a 100644
--- a/starmath/source/accessibility.hxx
+++ b/starmath/source/accessibility.hxx
@@ -52,7 +52,7 @@
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/implbase6.hxx>
-#include <svtools/brdcst.hxx>
+#include <svl/brdcst.hxx>
#include <svx/editeng.hxx>
#include <svx/unoedsrc.hxx> // SvxEditSource, SvxTextForwarder, SvxViewForwarder, SvxEditViewForwarder
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 175c41c173eb..e9a816fc76a4 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -1279,6 +1279,8 @@ void SmMathConfig::SetShowFormulaCursor( BOOL bVal )
SetOtherIfNotEqual( pOther->bFormulaCursor, bVal );
}
+void SmMathConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{}
/////////////////////////////////////////////////////////////////
diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx
index 4c028039ea5e..a56a503d7bfd 100644
--- a/starmath/source/cfgitem.hxx
+++ b/starmath/source/cfgitem.hxx
@@ -44,7 +44,7 @@
#include <tools/solar.h>
#include <rtl/ustring.hxx>
#include <unotools/configitem.hxx>
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
#include <vcl/timer.hxx>
#include <symbol.hxx>
@@ -174,7 +174,7 @@ public:
virtual ~SmMathConfig();
// utl::ConfigItem
- //virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
virtual void Commit();
// make some protected functions of utl::ConfigItem public
diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx
index b778571a5c0f..284a7898499d 100644
--- a/starmath/source/config.cxx
+++ b/starmath/source/config.cxx
@@ -32,15 +32,15 @@
#include "precompiled_starmath.hxx"
-#include <svtools/itemset.hxx>
-#include <svtools/hint.hxx>
-#include <svtools/smplhint.hxx>
-#include <svtools/pathoptions.hxx>
+#include <svl/itemset.hxx>
+#include <svl/hint.hxx>
+#include <svl/smplhint.hxx>
+#include <unotools/pathoptions.hxx>
#include <sfx2/sfxsids.hrc>
-#include <svtools/eitem.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/stritem.hxx>
-#include <svtools/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/itempool.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
#include <tools/stream.hxx>
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 20af2f38b3ee..95b2e0c36aad 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -34,9 +34,9 @@
#define SMDLL 1
#include "tools/rcid.h"
-#include <svtools/eitem.hxx>
-#include <svtools/intitem.hxx>
-#include <svtools/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
#include <sfx2/app.hxx>
#include <vcl/msgbox.hxx>
#include <svtools/ctrltool.hxx>
@@ -396,9 +396,9 @@ void SmFontDialog::InitColor_Impl()
#endif
ColorData nBgCol = COL_WHITE,
nTxtCol = COL_BLACK;
- if (GetDisplayBackground().GetColor().IsDark())
+ const StyleSettings &rS = GetSettings().GetStyleSettings();
+ if (rS.GetHighContrastMode())
{
- const StyleSettings &rS = GetSettings().GetStyleSettings();
nBgCol = rS.GetFieldColor().GetColor();
nTxtCol = rS.GetFieldTextColor().GetColor();
}
@@ -967,7 +967,7 @@ SmDistanceDialog::~SmDistanceDialog()
void SmDistanceDialog::ApplyImages()
{
- BOOL bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ BOOL bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
for (int i = 0; i < NOCATEGORIES; ++i)
{
SmCategoryDesc *pCat = Categories[i];
@@ -1551,9 +1551,9 @@ void SmSymbolDialog::InitColor_Impl()
#endif
ColorData nBgCol = COL_WHITE,
nTxtCol = COL_BLACK;
- if (GetDisplayBackground().GetColor().IsDark())
+ const StyleSettings &rS = GetSettings().GetStyleSettings();
+ if (rS.GetHighContrastMode())
{
- const StyleSettings &rS = GetSettings().GetStyleSettings();
nBgCol = rS.GetFieldColor().GetColor();
nTxtCol = rS.GetFieldTextColor().GetColor();
}
@@ -2180,7 +2180,7 @@ void SmSymDefineDialog::InitColor_Impl()
#endif
ColorData nBgCol = COL_WHITE,
nTxtCol = COL_BLACK;
- BOOL bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ BOOL bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
if (bHighContrast)
{
const StyleSettings &rS = GetSettings().GetStyleSettings();
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index f75b5fa5c9c8..81d137fa122f 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -55,22 +55,22 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <sot/storage.hxx>
-#include <svtools/eitem.hxx>
-#include <svtools/fstathelper.hxx>
-#include <svtools/intitem.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/lingucfg.hxx>
-#include <svtools/linguprops.hxx>
-#include <svtools/pathoptions.hxx>
-#include <svtools/ptitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/fstathelper.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itempool.hxx>
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svl/ptitem.hxx>
#include <svtools/sfxecode.hxx>
-#include <svtools/slstitm.hxx>
-#include <svtools/smplhint.hxx>
-#include <svtools/stritem.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/stritem.hxx>
#include <svtools/transfer.hxx>
-#include <svtools/undo.hxx>
-#include <svtools/urihelper.hxx>
-#include <svtools/whiter.hxx>
+#include <svl/undo.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/whiter.hxx>
#include <svx/editeng.hxx>
#include <svx/editstat.hxx>
#include <svx/eeitem.hxx>
@@ -462,7 +462,7 @@ void SmDocShell::Draw(OutputDevice &rDev, Point &rPosition)
ULONG nOldDrawMode = DRAWMODE_DEFAULT;
BOOL bRestoreDrawMode = FALSE;
if (OUTDEV_WINDOW == rDev.GetOutDevType() &&
- ((Window &) rDev).GetDisplayBackground().GetColor().IsDark())
+ ((Window &) rDev).GetSettings().GetStyleSettings().GetHighContrastMode())
{
nOldDrawMode = rDev.GetDrawMode();
rDev.SetDrawMode( DRAWMODE_DEFAULT );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 8435b7b5f35a..6f69f52539aa 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -52,13 +52,13 @@
#include <svx/editstat.hxx>
#include <svx/eeitem.hxx>
#include <sfx2/dispatch.hxx>
-#include <svtools/intitem.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itempool.hxx>
+#include <svl/stritem.hxx>
#include <svx/fhgtitem.hxx>
#include <svx/wghtitem.hxx>
#include <svx/lrspitem.hxx>
-#include <svtools/itemset.hxx>
+#include <svl/itemset.hxx>
#include <svx/fontitem.hxx>
#include <sfx2/viewfrm.hxx>
diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx
index 308eed0858d2..44e683306f05 100644
--- a/starmath/source/math_pch.cxx
+++ b/starmath/source/math_pch.cxx
@@ -48,11 +48,11 @@
#include <tools/rtti.hxx>
#include <tools/ref.hxx>
#include <tools/link.hxx>
-#include <svtools/brdcst.hxx>
-#include <svtools/svarray.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/svarray.hxx>
#include <tools/debug.hxx>
-#include <svtools/hint.hxx>
-#include <svtools/smplhint.hxx>
+#include <svl/hint.hxx>
+#include <svl/smplhint.hxx>
#include <sot/sotref.hxx>
#include <tools/globname.hxx>
#include <sot/factory.hxx>
@@ -130,9 +130,9 @@
#include <smdll.hxx>
#include <sfx2/sfxsids.hrc>
#include <chaos/cntids.hrc>
-#include <svtools/cntwids.hrc>
+#include <svl/cntwids.hrc>
#include <vcl/solar.hrc>
-#include <svtools/lstner.hxx>
+#include <svl/lstner.hxx>
#include <starmath.hrc>
#include <basic/sbx.hxx>
#include <basic/sbxform.hxx>
@@ -143,7 +143,7 @@
#include <basic/sbxmeth.hxx>
#include <tools/unqid.hxx>
#include <tools/unqidx.hxx>
-#include <svtools/poolitem.hxx>
+#include <svl/poolitem.hxx>
#include <svtools/args.hxx>
#include <smmod.hxx>
#include <vos/thread.hxx>
@@ -156,7 +156,7 @@
#include <vcl/timer.hxx>
#include <sfx2/app.hxx>
#include <sfx2/sfx.hrc>
-#include <svtools/memberid.hrc>
+#include <svl/memberid.hrc>
#include <vcl/syswin.hxx>
#include <vcl/virdev.hxx>
#include <tools/datetime.hxx>
@@ -736,7 +736,7 @@
#endif
#include <usr/refl.hxx>
#include <sfx2/msg.hxx>
-#include <svtools/itemset.hxx>
+#include <svl/itemset.hxx>
#include <sfx2/basedlgs.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/dialog.hxx>
@@ -745,10 +745,10 @@
#include <sfx2/frame.hxx>
#include <sfx2/objface.hxx>
#include <vcl/event.hxx>
-#include <svtools/eitem.hxx>
-#include <svtools/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
#include <symbol.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itempool.hxx>
#include <vcl/image.hxx>
#include <vcl/metric.hxx>
#include <sfx2/inimgr.hxx>
@@ -756,14 +756,14 @@
#include <tools/pstm.hxx>
#include <tools/table.hxx>
#include <sfx2/docfac.hxx>
-#include <svtools/ownlist.hxx>
+#include <svl/ownlist.hxx>
#include <sfx2/objsh.hxx>
-#include <svtools/stritem.hxx>
+#include <svl/stritem.hxx>
#include <vcl/mapmod.hxx>
#include <sfx2/ipfrm.hxx>
#include <vcl/dialog.hxx>
#include <sfx2/dispatch.hxx>
-#include <svtools/svstdarr.hxx>
+#include <svl/svstdarr.hxx>
#include <sfx2/bindings.hxx>
#include <dialog.hxx>
#include <vcl/button.hxx>
@@ -822,9 +822,9 @@
#include <vcl/toolbox.hxx>
#include <vcl/dockwin.hxx>
#include <smslots.hxx>
-#include <svtools/undo.hxx>
+#include <svl/undo.hxx>
#include <sfx2/request.hxx>
-#include <svtools/whiter.hxx>
+#include <svl/whiter.hxx>
#include <vcl/prntypes.hxx>
#include <vcl/jobset.hxx>
#include <vcl/gdimtf.hxx>
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 9ddabab9c325..c9b12abcdb90 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
@@ -61,9 +61,9 @@
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <svtools/sfxecode.hxx>
-#include <svtools/saveopt.hxx>
-#include <svtools/stritem.hxx>
-#include <svtools/itemprop.hxx>
+#include <unotools/saveopt.hxx>
+#include <svl/stritem.hxx>
+#include <svl/itemprop.hxx>
#include <unotools/processfactory.hxx>
#include <unotools/streamwrap.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -403,8 +403,8 @@ SmXMLExport::SmXMLExport(
{
}
-sal_Int64 SAL_CALL SmXMLExport::getSomething(
- const uno::Sequence< sal_Int8 >& rId )
+sal_Int64 SAL_CALL SmXMLExport::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
throw(uno::RuntimeException)
{
if ( rId.getLength() == 16 &&
@@ -833,7 +833,7 @@ void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel)
if (nSize >= 1 && pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
--nSize;
- // try to avoid creating a mtable element when the formula consists only
+ // try to avoid creating a mtable element when the formula consists only
// of a single output line
if (nLevel || (nSize >1))
pTable = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTABLE, sal_True, sal_True);
@@ -902,7 +902,7 @@ void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/)
void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/)
{
- //!! exports an empty <mi> tag since for example "~_~" is allowed in
+ //!! exports an empty <mi> tag since for example "~_~" is allowed in
//!! Math (so it has no sense at all) but must not result in an empty
//!! <msub> tag in MathML !!
@@ -910,7 +910,7 @@ void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/)
//const SmBlankNode *pTemp = static_cast<const SmBlankNode *>(pNode);
pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI, sal_True, sal_False);
-
+
GetDocHandler()->characters( OUString() );
delete pText;
}
@@ -1203,10 +1203,10 @@ void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel)
static bool lcl_HasEffectOnMathvariant( const SmTokenType eType )
{
- return eType == TBOLD || eType == TNBOLD ||
+ return eType == TBOLD || eType == TNBOLD ||
eType == TITALIC || eType == TNBOLD ||
eType == TSANS || eType == TSERIF || eType == TFIXED;
-}
+}
void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
{
@@ -1480,7 +1480,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel)
// thus at least it will not vanish into nothing
ExportText(pNode, nLevel);
}
- else
+ else
{
//To fully handle generic MathML we need to implement the full
//operator dictionary, we will generate MathML with explicit
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 1f7336db6d3c..bdbb7de5e8a9 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
@@ -57,9 +57,9 @@ one go*/
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <svtools/sfxecode.hxx>
-#include <svtools/saveopt.hxx>
-#include <svtools/stritem.hxx>
-#include <svtools/itemprop.hxx>
+#include <unotools/saveopt.hxx>
+#include <svl/stritem.hxx>
+#include <svl/itemprop.hxx>
#include <unotools/processfactory.hxx>
#include <unotools/streamwrap.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -337,7 +337,7 @@ ULONG SmXMLImportWrapper::ReadThroughComponent(
packages::zip::ZipIOException aBrokenPackage;
if ( aSaxEx.WrappedException >>= aBrokenPackage )
return ERRCODE_IO_BROKENPACKAGE;
-
+
if ( bEncrypted )
nError = ERRCODE_SFX_WRONGPASSWORD;
}
@@ -346,7 +346,7 @@ ULONG SmXMLImportWrapper::ReadThroughComponent(
packages::zip::ZipIOException aBrokenPackage;
if ( r.WrappedException >>= aBrokenPackage )
return ERRCODE_IO_BROKENPACKAGE;
-
+
if ( bEncrypted )
nError = ERRCODE_SFX_WRONGPASSWORD;
}
@@ -553,8 +553,8 @@ rtl::OUString SAL_CALL SmXMLImport::getImplementationName()
}
-sal_Int64 SAL_CALL SmXMLImport::getSomething(
- const uno::Sequence< sal_Int8 >&rId )
+sal_Int64 SAL_CALL SmXMLImport::getSomething(
+ const uno::Sequence< sal_Int8 >&rId )
throw(uno::RuntimeException)
{
if ( rId.getLength() == 16 &&
@@ -625,17 +625,17 @@ 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*/);
@@ -644,7 +644,7 @@ public:
void SmXMLImportContext::TCharacters(const OUString & /*rChars*/)
{
}
-
+
void SmXMLImportContext::Characters(const OUString &rChars)
{
/*
@@ -678,10 +678,10 @@ struct SmXMLContext_Helper
OUString sColor;
SmXMLImportContext rContext;
-
- SmXMLContext_Helper(SmXMLImportContext &rImport) :
+
+ SmXMLContext_Helper(SmXMLImportContext &rImport) :
nIsBold(-1), nIsItalic(-1), nFontSize(0.0), rContext(rImport) {}
-
+
void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &xAttrList );
void ApplyAttrs();
};
@@ -845,9 +845,9 @@ 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();
};
@@ -864,13 +864,13 @@ public:
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();
};
@@ -882,7 +882,7 @@ public:
SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -894,7 +894,7 @@ public:
SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -906,7 +906,7 @@ public:
SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -922,7 +922,7 @@ public:
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 );
};
@@ -1100,7 +1100,7 @@ public:
SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -1124,7 +1124,7 @@ public:
SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -1164,7 +1164,7 @@ public:
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName),
cBegin('('), cEnd(')') {}
-
+
void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList );
void EndElement();
};
@@ -1255,7 +1255,7 @@ public:
SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -1293,9 +1293,9 @@ public:
aToken.nLevel = 5;
aToken.eType = TNUMBER;
}
-
+
virtual void TCharacters(const OUString &rChars);
-
+
void EndElement();
};
@@ -1319,9 +1319,9 @@ 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<xml::sax::XAttributeList > & xAttrList );
};
@@ -1374,9 +1374,9 @@ public:
aToken.nLevel = 5;
aToken.eType = TTEXT;
}
-
+
virtual void TCharacters(const OUString &rChars);
-
+
void EndElement();
};
@@ -1407,9 +1407,9 @@ public:
aToken.nLevel = 5;
aToken.eType = TTEXT;
}
-
+
virtual void TCharacters(const OUString &rChars);
-
+
void EndElement();
};
@@ -1454,9 +1454,9 @@ public:
aToken.nLevel = 5;
aToken.eType = TIDENT;
}
-
+
void TCharacters(const OUString &rChars);
- void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList )
{
aStyleHelper.RetrieveAttrs(xAttrList);
};
@@ -1519,7 +1519,7 @@ public:
aToken.eType = TSPECIAL;
aToken.nLevel = 5;
}
-
+
void TCharacters(const OUString &rChars);
void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList );
void EndElement();
@@ -1578,7 +1578,7 @@ public:
SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLImportContext(rImport,nPrefix,rLName) {}
-
+
void StartElement(const uno::Reference< xml::sax::XAttributeList >& xAttrList );
};
@@ -1606,10 +1606,10 @@ public:
SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
- void EndElement()
- {
- GenericEndElement(TRSUB,RSUB);
+
+ void EndElement()
+ {
+ GenericEndElement(TRSUB,RSUB);
}
};
@@ -1647,7 +1647,7 @@ public:
SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLSubContext_Impl(rImport,nPrefix,rLName) {}
-
+
void EndElement()
{
GenericEndElement(TRSUP,RSUP);
@@ -1665,9 +1665,9 @@ public:
SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
-
- void EndElement()
- {
+
+ void EndElement()
+ {
GenericEndElement(TRSUB,RSUB,RSUP);
}
};
@@ -1711,7 +1711,7 @@ 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();
@@ -1782,7 +1782,7 @@ 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();
@@ -1836,9 +1836,9 @@ public:
SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {}
-
- void EndElement()
- {
+
+ void EndElement()
+ {
GenericEndElement(TCSUB,CSUB,CSUP);
}
};
@@ -1854,7 +1854,7 @@ public:
const OUString& rLName) :
SmXMLSubSupContext_Impl(rImport,nPrefix,rLName),
bHasPrescripts(FALSE) {}
-
+
void EndElement();
void MiddleElement();
SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
@@ -1870,7 +1870,7 @@ public:
SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
const OUString& rLName)
: SmXMLImportContext(rImport,nPrefix,rLName) {}
-
+
void EndElement();
};
@@ -1906,7 +1906,7 @@ public:
const OUString& rLName) :
SmXMLRowContext_Impl(rImport,nPrefix,rLName)
{}
-
+
SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > &xAttrList);
@@ -1922,7 +1922,7 @@ public:
const OUString& rLName) :
SmXMLTableRowContext_Impl(rImport,nPrefix,rLName)
{}
-
+
void EndElement();
SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
const OUString& rLocalName,
@@ -1950,9 +1950,9 @@ public:
const OUString& rLName) :
SmXMLRowContext_Impl(rImport,nPrefix,rLName)
{}
-
+
/*Don't do anything with alignment for now*/
- void EndElement()
+ void EndElement()
{
}
};
@@ -1966,7 +1966,7 @@ public:
const OUString& rLName) :
SmXMLRowContext_Impl(rImport,nPrefix,rLName)
{}
-
+
void EndElement();
};
@@ -1980,7 +1980,7 @@ 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);
};
@@ -1990,10 +1990,10 @@ SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPref
{
SvXMLImportContext *pContext = 0;
if ( XML_NAMESPACE_OFFICE == nPrefix &&
- rLocalName == GetXMLToken(XML_META) )
+ 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) )
{
@@ -2049,8 +2049,8 @@ SvXMLImportContext *SmXMLFlatDocContext_Impl::CreateChildContext(
{
return SvXMLMetaDocumentContext::CreateChildContext(
i_nPrefix, i_rLocalName, i_xAttrList );
- }
- else
+ }
+ else
{
return SmXMLOfficeContext_Impl::CreateChildContext(
i_nPrefix, i_rLocalName, i_xAttrList );
@@ -2837,10 +2837,10 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
const OUString &rLocalName,
const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
{
- if ( XML_NAMESPACE_OFFICE == nPrefix )
+ if ( XML_NAMESPACE_OFFICE == nPrefix )
{
if ( (IsXMLToken(rLocalName, XML_DOCUMENT) ||
- IsXMLToken(rLocalName, XML_DOCUMENT_META)))
+ IsXMLToken(rLocalName, XML_DOCUMENT_META)))
{
uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
mxServiceFactory->createInstance(
@@ -2856,12 +2856,12 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
// flat OpenDocument file format -- this has not been tested...
: new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
xDPS->getDocumentProperties(), xDocBuilder);
- }
- else
+ }
+ else
{
return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName);
}
- }
+ }
else
return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName);
}
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 83662e50b123..727d595b40ea 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -40,7 +40,7 @@
#include <i18npool/lang.h>
#include <unotools/charclass.hxx>
#include <svx/unolingu.hxx>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
#include "parse.hxx"
#ifndef _STARMATH_HRC
#include "starmath.hrc"
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index f65b7fcdc764..f7008403cddf 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -60,10 +60,10 @@
#include <rtl/ustring.h>
#include <rtl/logfile.hxx>
-#include <svtools/itemset.hxx>
+#include <svl/itemset.hxx>
#include <vcl/window.hxx>
-#include <svtools/eitem.hxx>
-#include <svtools/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
#include <tools/urlobj.hxx>
#include <vos/mutex.hxx>
#include <svtools/sfxecode.hxx>
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 20cfc284d006..8ad99121acfa 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -37,7 +37,7 @@
#include <sfx2/msg.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
-#include <svtools/whiter.hxx>
+#include <svl/whiter.hxx>
#include <sfx2/request.hxx>
#include <sfx2/sfx.hrc>
#include <sfx2/viewsh.hxx>
@@ -47,7 +47,7 @@
#endif
#include <vcl/msgbox.hxx>
#include <vcl/virdev.hxx>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
#include <tools/rtti.hxx>
#include "smmod.hxx"
#include "symbol.hxx"
@@ -251,6 +251,8 @@ SmModule::SmModule(SfxObjectFactory* pObjFact) :
SmModule::~SmModule()
{
delete pConfig;
+ if (pColorConfig)
+ pColorConfig->RemoveListener(this);
delete pColorConfig;
delete pLocSymbolData;
delete pSysLocale;
@@ -295,19 +297,14 @@ svtools::ColorConfig & SmModule::GetColorConfig()
{
pColorConfig = new svtools::ColorConfig;
ApplyColorConfigValues( *pColorConfig );
- StartListening( *pColorConfig );
+ pColorConfig->AddListener(this);
}
return *pColorConfig;
}
-void SmModule::Notify( SfxBroadcaster & /*rBC*/, const SfxHint &rHint )
+void SmModule::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
{
- if (rHint.ISA(SfxSimpleHint))
- {
- ULONG nHintId = ((SfxSimpleHint&)rHint).GetId();
- if (SFX_HINT_COLORS_CHANGED == nHintId)
- ApplyColorConfigValues(*pColorConfig);
- }
+ ApplyColorConfigValues(*pColorConfig);
}
SmConfig * SmModule::GetConfig()
diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx
index 487bd6155fc9..c775f9be038b 100644
--- a/starmath/source/toolbox.cxx
+++ b/starmath/source/toolbox.cxx
@@ -33,9 +33,9 @@
#include <rtl/logfile.hxx>
-#include <svtools/eitem.hxx>
+#include <svl/eitem.hxx>
#include <sfx2/app.hxx>
-#include <svtools/intitem.hxx>
+#include <svl/intitem.hxx>
#include <svtools/imgdef.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/imgmgr.hxx>
@@ -222,7 +222,7 @@ const ImageList * SmToolBoxWindow::GetImageList( USHORT nResId, BOOL bHighContra
void SmToolBoxWindow::ApplyImageLists( USHORT nCategoryRID )
{
- BOOL bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ BOOL bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
// set image list for toolbox 'catalog'
const ImageList *pImageList = GetImageList( bHighContrast ? RID_ILH_CATALOG : RID_IL_CATALOG, bHighContrast );
diff --git a/starmath/source/typemap.cxx b/starmath/source/typemap.cxx
index d0e796533e3f..bc61839af470 100644
--- a/starmath/source/typemap.cxx
+++ b/starmath/source/typemap.cxx
@@ -141,10 +141,10 @@
#define SvxCellVerJustifyEnumItem SfxVoidItem
#define SvxCellOrientationEnumItem SfxVoidItem
#include <sfx2/msg.hxx>
-#include <svtools/stritem.hxx>
-#include <svtools/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
#include <svx/zoomitem.hxx>
-#include <svtools/slstitm.hxx>
+#include <svl/slstitm.hxx>
#define SFX_TYPEMAP
#include "smslots.hxx"
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 2527ddb41b81..eadf909cfc64 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -1,1135 +1,1135 @@
-/*************************************************************************
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_starmath.hxx"
-
-
-#include <vos/mutex.hxx>
-#include <osl/mutex.hxx>
-#include <sfx2/printer.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/ctrltool.hxx>
-#include <svtools/itemprop.hxx>
-#include <unotools/localedatawrapper.hxx>
-#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>
-#include <com/sun/star/formula/SymbolDescriptor.hpp>
-#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <xmloff/xmluconv.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <comphelper/propertysetinfo.hxx>
-#include <svtools/moduleoptions.hxx>
-
-#include <unomodel.hxx>
-#include <document.hxx>
-#include <view.hxx>
-#include <symbol.hxx>
-#include <starmath.hrc>
-#include <config.hxx>
-#include <smdll.hxx>
-
-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))
-
-////////////////////////////////////////////////////////////
-
-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
-//
-#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<XServiceInfo>*)0);
- pTypes[nLen++] = ::getCppuType((Reference<XPropertySet>*)0);
- pTypes[nLen++] = ::getCppuType((Reference<XMultiPropertySet>*)0);
- pTypes[nLen++] = ::getCppuType((Reference<XRenderable>*)0);
-
- // XPropertyState not supported?? (respective virtual functions from
- // PropertySetHelper not overloaded)
- //pTypes[nLen++] = ::getCppuType((Reference<XPropertyState>*)0);
-
- return aTypes;
-}
-/* -----------------------------28.03.00 14:23--------------------------------
-
- ---------------------------------------------------------------------------*/
-const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId()
-{
- static osl::Mutex aCreateMutex;
- osl::Guard<osl::Mutex> 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 SmSym * >::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;
-}
-
-
-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 >& /*rxOptions*/ )
- 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 = 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;
-
- if (!m_pPrintUIOptions)
- m_pPrintUIOptions = new SmPrintUIOptions();
- 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()));
-
- 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;
- }
- }
- }
- }
-}
-
-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<SfxObjectShell *>(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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_starmath.hxx"
+
+
+#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <sfx2/printer.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svl/itemprop.hxx>
+#include <unotools/localedatawrapper.hxx>
+#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>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <svtools/moduleoptions.hxx>
+
+#include <unomodel.hxx>
+#include <document.hxx>
+#include <view.hxx>
+#include <symbol.hxx>
+#include <starmath.hrc>
+#include <config.hxx>
+#include <smdll.hxx>
+
+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))
+
+////////////////////////////////////////////////////////////
+
+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
+//
+#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<XServiceInfo>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XPropertySet>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XMultiPropertySet>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XRenderable>*)0);
+
+ // XPropertyState not supported?? (respective virtual functions from
+ // PropertySetHelper not overloaded)
+ //pTypes[nLen++] = ::getCppuType((Reference<XPropertyState>*)0);
+
+ return aTypes;
+}
+/* -----------------------------28.03.00 14:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId()
+{
+ static osl::Mutex aCreateMutex;
+ osl::Guard<osl::Mutex> 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 SmSym * >::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;
+}
+
+
+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 >& /*rxOptions*/ )
+ 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 = 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;
+
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = new SmPrintUIOptions();
+ 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()));
+
+ 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;
+ }
+ }
+ }
+ }
+}
+
+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<SfxObjectShell *>(xParentTunnel->getSomething(
+ uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) );
+ if ( pDoc )
+ GetObjectShell()->OnDocumentPrinterChanged( pDoc->GetDocumentPrinter() );
+ }
+}
+
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index c31e83132ee2..288018596643 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -51,15 +51,15 @@
#include <sfx2/objface.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/request.hxx>
-#include <svtools/eitem.hxx>
-#include <svtools/intitem.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/poolitem.hxx>
-#include <svtools/ptitem.hxx>
-#include <svtools/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itemset.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/stritem.hxx>
#include <svtools/transfer.hxx>
-#include <svtools/undo.hxx>
-#include <svtools/whiter.hxx>
+#include <svl/undo.hxx>
+#include <svl/whiter.hxx>
#include <svx/dialogs.hrc>
#include <svx/editeng.hxx>
#include <svx/svxdlg.hxx>
@@ -1626,7 +1626,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet, RID_SVXDLG_ZOOM);
+ pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet);
DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
}
pDlg->SetLimits( MINZOOM, MAXZOOM );