diff options
author | Philipp Lohmann <pl@openoffice.org> | 2009-04-03 13:22:58 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2009-04-03 13:22:58 +0000 |
commit | 834af237fb233c59a8b9b070b12f61b5f94548be (patch) | |
tree | f1d741acb21850e1cd3d940b7fd6f640e5abac5d /starmath | |
parent | b95e256d3e1e1becc24065864cb1da7bf0e89691 (diff) |
#i92516# preparations for new print UI
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/starmath.hrc | 2 | ||||
-rw-r--r-- | starmath/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | starmath/source/smres.src | 202 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 193 |
4 files changed, 213 insertions, 186 deletions
diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 6d117bcc9524..e957ee454bdf 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -103,6 +103,8 @@ #define RID_SYMBOLDIALOG (RID_APP_START + 8) #define RID_SYMDEFINEDIALOG (RID_APP_START + 9) #define RID_EXTRAOPTIONPAGE (RID_APP_START + 10) +#define RID_PRINTUIOPTIONS (RID_APP_START + 11) + #define RID_MATH_TOOLBOX (RID_APP_START + 50) // wegen #58705# entfernt //#define RID_DRAW_OBJECTBAR (RID_APP_START + 51) diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 2b3808ae4ca4..0bdd13ea0ac1 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -39,6 +39,7 @@ #include <comphelper/propertysethelper.hxx> class SmFormat; +class PrintUIOptions; //----------------------------------------------------------------------------- class SmModel : public SfxBaseModel, @@ -46,6 +47,7 @@ class SmModel : public SfxBaseModel, public com::sun::star::lang::XServiceInfo, public com::sun::star::view::XRenderable { + PrintUIOptions* m_pPrintUIOptions; protected: virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); diff --git a/starmath/source/smres.src b/starmath/source/smres.src index 023fc1a483ce..e45cf2cc3711 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -3582,189 +3582,21 @@ String RID_MATH_TOOLBOX Text [ en-US ] = "Main Toolbar" ; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +StringArray RID_PRINTUIOPTIONS +{ + ItemList [en-US] = + { + <"Formula"; >; + < "Print options"; >; + < "~Title row"; >; + < "~Formula text"; >; + < "B~order"; >; + < "Print format"; >; + < "O~riginal size"; >; + < "Fit to ~page"; >; + < "~Scaling"; >; + < "Miscellaneous options"; >; + < "Ig~nore ~~ and ` at the end of the line"; >; + }; +}; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 8fc038f48e1a..57d9e909386f 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -80,6 +80,184 @@ using namespace ::com::sun::star::script; #define C2U(cChar) rtl::OUString::createFromAscii(cChar) +class PrintUIOptions +{ + ResStringArray m_aLocalizedStrings; + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal = NULL, + const Sequence< rtl::OUString >* i_pChoices = NULL, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); + + Any getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + const rtl::OUString* i_pDependsOnName = NULL, + sal_Int32 i_nDependsOnEntry = -1 + ); +public: + PrintUIOptions(); + + void addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ); +}; + +PrintUIOptions::PrintUIOptions() +: m_aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ) +{ +} + +Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal, + const Sequence< rtl::OUString >* i_pChoices, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry + ) +{ + Sequence< PropertyValue > aCtrl(6); + sal_Int32 nUsed = 0; + if( i_rTitle.getLength() ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); + aCtrl[nUsed++].Value = makeAny( i_rTitle ); + } + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); + aCtrl[nUsed++].Value = makeAny( i_rType ); + if( i_pVal ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pVal ); + } + if( i_pChoices ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pChoices ); + } + if( i_pDependsOnName ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pDependsOnName ); + if( i_nDependsOnEntry != -1 ) + { + aCtrl[nUsed ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) ); + aCtrl[nUsed++].Value = makeAny( i_nDependsOnEntry ); + } + } + aCtrl.realloc( nUsed ); + return makeAny( aCtrl ); +} + +Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) +{ + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_bValue ); + return getUIControlOpt( i_rTitle, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, NULL, i_pDependsOnName, i_nDependsOnEntry ); +} + +Any PrintUIOptions::getUIControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rType, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + const rtl::OUString* i_pDependsOnName, + sal_Int32 i_nDependsOnEntry ) +{ + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_rChoices ); + return getUIControlOpt( i_rTitle, i_rType, &aVal, &i_rChoices, i_pDependsOnName, i_nDependsOnEntry ); +} + +void PrintUIOptions::addPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) +{ + // create sequence of print UI options + uno::Sequence< beans::PropertyValue > aUIOptions( 10 ); + + DBG_ASSERT( m_aLocalizedStrings.Count() >= 10, "resource incomplete" ); + if( m_aLocalizedStrings.Count() < 10 ) // bad resource ? + return; + + // create Section for formula (results in an extra tab page in dialog) + aUIOptions[0].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 0 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + + // create subgroup for print options + aUIOptions[1].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 1 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a bool option for title row + aUIOptions[2].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 2 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TitleRow" ) ), + sal_True ); + // create a bool option for formula text + aUIOptions[3].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormulaText" ) ), + sal_True ); + // create a bool option for border + aUIOptions[4].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); + + // create subgroup for print format + aUIOptions[5].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a radio button group for print format + Sequence< rtl::OUString > aChoices( 3 ); + aChoices[0] = m_aLocalizedStrings.GetString( 6 ); + aChoices[1] = m_aLocalizedStrings.GetString( 7 ); + aChoices[2] = m_aLocalizedStrings.GetString( 8 ); + OUString aPrintFormatProp( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ); + aUIOptions[6].Value = getUIControlOpt( rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintFormat" ) ), + aChoices + ); + + // create a numeric box for scale dependent on PrintFormat = "Scaling" + PropertyValue aVal; + aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintScale" ) ); + aVal.Value = makeAny( sal_Int32( 100 ) ); + aUIOptions[ 7 ].Value = getUIControlOpt( rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), + &aVal, + NULL, + &aPrintFormatProp, + 2 ); + + // create subgroup for misc options + aUIOptions[8].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 9 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ) ); + + // create a bool option for ignore spacing + aUIOptions[9].Value = getUIControlOpt( m_aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), + sal_True ); + + sal_Int32 nLen = io_rProps.getLength(); + io_rProps.realloc( nLen+1 ); + io_rProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); + io_rProps[nLen].Value = uno::makeAny( aUIOptions ); +} + + + + //////////////////////////////////////// // // class SmModel @@ -230,11 +408,14 @@ PropertySetInfo * lcl_createModelPropertyInfo () SmModel::SmModel( SfxObjectShell *pObjSh ) : SfxBaseModel(pObjSh) , PropertySetHelper ( lcl_createModelPropertyInfo () ) +, m_pPrintUIOptions( NULL ) + { } //----------------------------------------------------------------------- SmModel::~SmModel() throw () { + delete m_pPrintUIOptions; } /*-- 28.03.00 14:18:17--------------------------------------------------- @@ -860,6 +1041,9 @@ sal_Int32 SAL_CALL SmModel::getRendererCount( throw (IllegalArgumentException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new PrintUIOptions(); + return 1; } @@ -886,7 +1070,6 @@ static Size lcl_GuessPaperSize() return aRes; } - uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( sal_Int32 nRenderer, const uno::Any& /*rSelection*/, @@ -895,6 +1078,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( { ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new PrintUIOptions(); + if (0 != nRenderer) throw IllegalArgumentException(); @@ -918,6 +1104,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; + m_pPrintUIOptions->addPrintUIOptions( aRenderer ); + return aRenderer; } @@ -929,6 +1117,9 @@ void SAL_CALL SmModel::render( { ::vos::OGuard aGuard(Application::GetSolarMutex()); + if( ! m_pPrintUIOptions ) + m_pPrintUIOptions = new PrintUIOptions(); + if (0 != nRenderer) throw IllegalArgumentException(); |