LCOV - code coverage report
Current view: top level - starmath/source - unomodel.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 535 0.0 %
Date: 2014-04-14 Functions: 0 31 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <osl/mutex.hxx>
      21             : #include <sfx2/printer.hxx>
      22             : #include <vcl/svapp.hxx>
      23             : #include <svtools/ctrltool.hxx>
      24             : #include <svl/itemprop.hxx>
      25             : #include <unotools/localedatawrapper.hxx>
      26             : #include <comphelper/processfactory.hxx>
      27             : #include <editeng/paperinf.hxx>
      28             : #include <vcl/settings.hxx>
      29             : #include <vcl/print.hxx>
      30             : #include <toolkit/awt/vclxdevice.hxx>
      31             : #include <com/sun/star/beans/PropertyState.hpp>
      32             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      33             : #include <com/sun/star/formula/SymbolDescriptor.hpp>
      34             : #include <com/sun/star/awt/Size.hpp>
      35             : #include <com/sun/star/script/XLibraryContainer.hpp>
      36             : #include <xmloff/xmluconv.hxx>
      37             : #include <rtl/ustrbuf.hxx>
      38             : #include <comphelper/propertysetinfo.hxx>
      39             : #include <comphelper/servicehelper.hxx>
      40             : #include <cppuhelper/supportsservice.hxx>
      41             : #include <unotools/moduleoptions.hxx>
      42             : #include <tools/mapunit.hxx>
      43             : 
      44             : #include <unomodel.hxx>
      45             : #include <document.hxx>
      46             : #include <view.hxx>
      47             : #include <symbol.hxx>
      48             : #include <starmath.hrc>
      49             : #include <config.hxx>
      50             : #include <smdll.hxx>
      51             : 
      52             : using namespace ::cppu;
      53             : using namespace ::std;
      54             : using namespace ::comphelper;
      55             : using namespace ::com::sun::star;
      56             : using namespace ::com::sun::star::uno;
      57             : using namespace ::com::sun::star::beans;
      58             : using namespace ::com::sun::star::lang;
      59             : using namespace ::com::sun::star::formula;
      60             : using namespace ::com::sun::star::view;
      61             : using namespace ::com::sun::star::script;
      62             : 
      63           0 : SmPrintUIOptions::SmPrintUIOptions()
      64             : {
      65           0 :     ResStringArray      aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) );
      66             :     SAL_WARN_IF( aLocalizedStrings.Count() < 18, "starmath", "resource incomplete" );
      67           0 :     if( aLocalizedStrings.Count() < 9 ) // bad resource ?
      68           0 :         return;
      69             : 
      70           0 :     SmModule *pp = SM_MOD();
      71           0 :     SmConfig *pConfig = pp->GetConfig();
      72             :     SAL_WARN_IF( !pConfig, "starmath", "SmConfig not found" );
      73           0 :     if (!pConfig)
      74           0 :         return;
      75             : 
      76           0 :     sal_Int32 nNumProps = 10, nIdx=0;
      77             : 
      78             :     // create sequence of print UI options
      79             :     // (Actually IsIgnoreSpacesRight is a parser option. Without it we need only 8 properties here.)
      80           0 :     m_aUIProperties.realloc( nNumProps );
      81             : 
      82             :     // load the math PrinterOptions into the custom tab
      83           0 :     m_aUIProperties[nIdx].Name = "OptionsUIFile";
      84           0 :     m_aUIProperties[nIdx++].Value <<= OUString("modules/smath/ui/printeroptions.ui");
      85             : 
      86             :     // create Section for formula (results in an extra tab page in dialog)
      87           0 :     SvtModuleOptions aOpt;
      88             :     OUString aAppGroupname(
      89             :         aLocalizedStrings.GetString( 0 ).
      90           0 :             replaceFirst( "%s", aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) ) );
      91           0 :     m_aUIProperties[nIdx++].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, ".HelpID:vcl:PrintDialog:TabPage:AppPage");
      92             : 
      93             :     // create subgroup for print options
      94           0 :     m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("contents", aLocalizedStrings.GetString(1), OUString());
      95             : 
      96             :     // create a bool option for title row (matches to SID_PRINTTITLE)
      97           0 :     m_aUIProperties[nIdx++].Value = setBoolControlOpt("title", aLocalizedStrings.GetString( 2 ),
      98             :                                                   ".HelpID:vcl:PrintDialog:TitleRow:CheckBox",
      99             :                                                   PRTUIOPT_TITLE_ROW,
     100           0 :                                                   pConfig->IsPrintTitle());
     101             :     // create a bool option for formula text (matches to SID_PRINTTEXT)
     102           0 :     m_aUIProperties[nIdx++].Value = setBoolControlOpt("formulatext", aLocalizedStrings.GetString( 3 ),
     103             :                                                   ".HelpID:vcl:PrintDialog:FormulaText:CheckBox",
     104             :                                                   PRTUIOPT_FORMULA_TEXT,
     105           0 :                                                   pConfig->IsPrintFormulaText());
     106             :     // create a bool option for border (matches to SID_PRINTFRAME)
     107           0 :     m_aUIProperties[nIdx++].Value = setBoolControlOpt("borders", aLocalizedStrings.GetString( 4 ),
     108             :                                                   ".HelpID:vcl:PrintDialog:Border:CheckBox",
     109             :                                                   PRTUIOPT_BORDER,
     110           0 :                                                   pConfig->IsPrintFrame());
     111             : 
     112             :     // create subgroup for print format
     113           0 :     m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("size", aLocalizedStrings.GetString(5), OUString());
     114             : 
     115             :     // create a radio button group for print format (matches to SID_PRINTSIZE)
     116           0 :     Sequence< OUString > aChoices( 3 );
     117           0 :     aChoices[0] = aLocalizedStrings.GetString( 6 );
     118           0 :     aChoices[1] = aLocalizedStrings.GetString( 7 );
     119           0 :     aChoices[2] = aLocalizedStrings.GetString( 8 );
     120           0 :     Sequence< OUString > aHelpIds( 3 );
     121           0 :     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintFormat:RadioButton:0";
     122           0 :     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintFormat:RadioButton:1";
     123           0 :     aHelpIds[2] = ".HelpID:vcl:PrintDialog:PrintFormat:RadioButton:2";
     124           0 :     Sequence< OUString > aWidgetIds( 3 );
     125           0 :     aWidgetIds[0] = "originalsize";
     126           0 :     aWidgetIds[1] = "fittopage";
     127           0 :     aWidgetIds[2] = "scaling";
     128           0 :     OUString aPrintFormatProp( PRTUIOPT_PRINT_FORMAT );
     129           0 :     m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),
     130             :                                                     aHelpIds,
     131             :                                                     aPrintFormatProp,
     132           0 :                                                     aChoices, static_cast< sal_Int32 >(pConfig->GetPrintSize())
     133           0 :                                                     );
     134             : 
     135             :     // create a numeric box for scale dependent on PrintFormat = "Scaling" (matches to SID_PRINTZOOM)
     136           0 :     vcl::PrinterOptionsHelper::UIControlOptions aRangeOpt( aPrintFormatProp, 2, true );
     137           0 :     m_aUIProperties[nIdx++].Value = setRangeControlOpt("scalingspin", OUString(),
     138             :                                                      ".HelpID:vcl:PrintDialog:PrintScale:NumericField",
     139             :                                                      PRTUIOPT_PRINT_SCALE,
     140           0 :                                                      pConfig->GetPrintZoomFactor(),    // initial value
     141             :                                                      10,     // min value
     142             :                                                      1000,   // max value
     143           0 :                                                      aRangeOpt);
     144             : 
     145           0 :     Sequence< PropertyValue > aHintNoLayoutPage( 1 );
     146           0 :     aHintNoLayoutPage[0].Name = "HintNoLayoutPage";
     147           0 :     aHintNoLayoutPage[0].Value = makeAny( sal_True );
     148           0 :     m_aUIProperties[nIdx++].Value <<= aHintNoLayoutPage;
     149             : 
     150           0 :     assert(nIdx == nNumProps);
     151             : }
     152             : 
     153             : 
     154             : 
     155             : 
     156             : // class SmModel
     157             : 
     158             : 
     159             : // values from com/sun/star/beans/PropertyAttribute
     160             : #define PROPERTY_NONE        0
     161             : 
     162             : enum SmModelPropertyHandles
     163             : {
     164             :     HANDLE_FORMULA,
     165             :     HANDLE_FONT_NAME_VARIABLES,
     166             :     HANDLE_FONT_NAME_FUNCTIONS,
     167             :     HANDLE_FONT_NAME_NUMBERS,
     168             :     HANDLE_FONT_NAME_TEXT,
     169             :     HANDLE_CUSTOM_FONT_NAME_SERIF,
     170             :     HANDLE_CUSTOM_FONT_NAME_SANS,
     171             :     HANDLE_CUSTOM_FONT_NAME_FIXED,
     172             :     HANDLE_CUSTOM_FONT_FIXED_POSTURE,
     173             :     HANDLE_CUSTOM_FONT_FIXED_WEIGHT,
     174             :     HANDLE_CUSTOM_FONT_SANS_POSTURE,
     175             :     HANDLE_CUSTOM_FONT_SANS_WEIGHT,
     176             :     HANDLE_CUSTOM_FONT_SERIF_POSTURE,
     177             :     HANDLE_CUSTOM_FONT_SERIF_WEIGHT,
     178             :     HANDLE_FONT_VARIABLES_POSTURE,
     179             :     HANDLE_FONT_VARIABLES_WEIGHT,
     180             :     HANDLE_FONT_FUNCTIONS_POSTURE,
     181             :     HANDLE_FONT_FUNCTIONS_WEIGHT,
     182             :     HANDLE_FONT_NUMBERS_POSTURE,
     183             :     HANDLE_FONT_NUMBERS_WEIGHT,
     184             :     HANDLE_FONT_TEXT_POSTURE,
     185             :     HANDLE_FONT_TEXT_WEIGHT,
     186             :     HANDLE_BASE_FONT_HEIGHT,
     187             :     HANDLE_RELATIVE_FONT_HEIGHT_TEXT,
     188             :     HANDLE_RELATIVE_FONT_HEIGHT_INDICES,
     189             :     HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS,
     190             :     HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS,
     191             :     HANDLE_RELATIVE_FONT_HEIGHT_LIMITS,
     192             :     HANDLE_IS_TEXT_MODE,
     193             :     HANDLE_GREEK_CHAR_STYLE,
     194             :     HANDLE_ALIGNMENT,
     195             :     HANDLE_RELATIVE_SPACING,
     196             :     HANDLE_RELATIVE_LINE_SPACING,
     197             :     HANDLE_RELATIVE_ROOT_SPACING,
     198             :     HANDLE_RELATIVE_INDEX_SUPERSCRIPT,
     199             :     HANDLE_RELATIVE_INDEX_SUBSCRIPT,
     200             :     HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT,
     201             :     HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH,
     202             :     HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH,
     203             :     HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT,
     204             :     HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE,
     205             :     HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE,
     206             :     HANDLE_RELATIVE_BRACKET_EXCESS_SIZE,
     207             :     HANDLE_RELATIVE_BRACKET_DISTANCE,
     208             :     HANDLE_IS_SCALE_ALL_BRACKETS,
     209             :     HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE,
     210             :     HANDLE_RELATIVE_MATRIX_LINE_SPACING,
     211             :     HANDLE_RELATIVE_MATRIX_COLUMN_SPACING,
     212             :     HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT,
     213             :     HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT,
     214             :     HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE,
     215             :     HANDLE_RELATIVE_OPERATOR_SPACING,
     216             :     HANDLE_LEFT_MARGIN,
     217             :     HANDLE_RIGHT_MARGIN,
     218             :     HANDLE_TOP_MARGIN,
     219             :     HANDLE_BOTTOM_MARGIN,
     220             :     HANDLE_PRINTER_NAME,
     221             :     HANDLE_PRINTER_SETUP,
     222             :     HANDLE_SYMBOLS,
     223             :     HANDLE_USED_SYMBOLS,
     224             :     HANDLE_BASIC_LIBRARIES,
     225             :     HANDLE_RUNTIME_UID,
     226             :     HANDLE_LOAD_READONLY,     // Security Options
     227             :     HANDLE_DIALOG_LIBRARIES,  // #i73329#
     228             :     HANDLE_BASELINE,
     229             :     HANDLE_INTEROP_GRAB_BAG,
     230             : };
     231             : 
     232           0 : static PropertySetInfo * lcl_createModelPropertyInfo ()
     233             : {
     234             :     static PropertyMapEntry aModelPropertyInfoMap[] =
     235             :     {
     236           0 :         { OUString("Alignment")                        , HANDLE_ALIGNMENT                          ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  0                     },
     237           0 :         { OUString("BaseFontHeight")                   , HANDLE_BASE_FONT_HEIGHT                   ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  0                     },
     238           0 :         { OUString("BasicLibraries")                   , HANDLE_BASIC_LIBRARIES                    ,  ::getCppuType((const uno::Reference< script::XLibraryContainer > *)0),  PropertyAttribute::READONLY,  0       },
     239           0 :         { OUString("BottomMargin")                     , HANDLE_BOTTOM_MARGIN                      ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_BOTTOMSPACE       },
     240           0 :         { OUString("CustomFontNameFixed")              , HANDLE_CUSTOM_FONT_NAME_FIXED             ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_FIXED             },
     241           0 :         { OUString("CustomFontNameSans")               , HANDLE_CUSTOM_FONT_NAME_SANS              ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_SANS              },
     242           0 :         { OUString("CustomFontNameSerif")              , HANDLE_CUSTOM_FONT_NAME_SERIF             ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_SERIF             },
     243           0 :         { OUString("DialogLibraries")                  , HANDLE_DIALOG_LIBRARIES                   ,  ::getCppuType((const uno::Reference< script::XLibraryContainer > *)0),  PropertyAttribute::READONLY,  0       },
     244           0 :         { OUString("FontFixedIsBold")                  , HANDLE_CUSTOM_FONT_FIXED_WEIGHT           ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_FIXED             },
     245           0 :         { OUString("FontFixedIsItalic")                , HANDLE_CUSTOM_FONT_FIXED_POSTURE          ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_FIXED             },
     246           0 :         { OUString("FontFunctionsIsBold")              , HANDLE_FONT_FUNCTIONS_WEIGHT              ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_FUNCTION          },
     247           0 :         { OUString("FontFunctionsIsItalic")            , HANDLE_FONT_FUNCTIONS_POSTURE             ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_FUNCTION          },
     248           0 :         { OUString("FontNameFunctions")                , HANDLE_FONT_NAME_FUNCTIONS                ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_FUNCTION          },
     249           0 :         { OUString("FontNameNumbers")                  , HANDLE_FONT_NAME_NUMBERS                  ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_NUMBER            },
     250           0 :         { OUString("FontNameText")                     , HANDLE_FONT_NAME_TEXT                     ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_TEXT              },
     251           0 :         { OUString("FontNameVariables")                , HANDLE_FONT_NAME_VARIABLES                ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  FNT_VARIABLE          },
     252           0 :         { OUString("FontNumbersIsBold")                , HANDLE_FONT_NUMBERS_WEIGHT                ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_NUMBER            },
     253           0 :         { OUString("FontNumbersIsItalic")              , HANDLE_FONT_NUMBERS_POSTURE               ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_NUMBER            },
     254           0 :         { OUString("FontSansIsBold")                   , HANDLE_CUSTOM_FONT_SANS_WEIGHT            ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_SANS              },
     255           0 :         { OUString("FontSansIsItalic")                 , HANDLE_CUSTOM_FONT_SANS_POSTURE           ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_SANS              },
     256           0 :         { OUString("FontSerifIsBold")                  , HANDLE_CUSTOM_FONT_SERIF_WEIGHT           ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_SERIF             },
     257           0 :         { OUString("FontSerifIsItalic")                , HANDLE_CUSTOM_FONT_SERIF_POSTURE          ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_SERIF             },
     258           0 :         { OUString("FontTextIsBold")                   , HANDLE_FONT_TEXT_WEIGHT                   ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_TEXT              },
     259           0 :         { OUString("FontTextIsItalic")                 , HANDLE_FONT_TEXT_POSTURE                  ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_TEXT              },
     260           0 :         { OUString("FontVariablesIsBold")              , HANDLE_FONT_VARIABLES_WEIGHT              ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_VARIABLE          },
     261           0 :         { OUString("FontVariablesIsItalic")            , HANDLE_FONT_VARIABLES_POSTURE             ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  FNT_VARIABLE          },
     262           0 :         { OUString("Formula")                          , HANDLE_FORMULA                            ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  0                     },
     263           0 :         { OUString("IsScaleAllBrackets")               , HANDLE_IS_SCALE_ALL_BRACKETS              ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  0                     },
     264           0 :         { OUString("IsTextMode")                       , HANDLE_IS_TEXT_MODE                       ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  0                     },
     265           0 :         { OUString("GreekCharStyle")                   , HANDLE_GREEK_CHAR_STYLE                   ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  0                     },
     266           0 :         { OUString("LeftMargin")                       , HANDLE_LEFT_MARGIN                        ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_LEFTSPACE         },
     267           0 :         { OUString("PrinterName")                      , HANDLE_PRINTER_NAME                       ,  ::getCppuType((const OUString*)0),                                      PROPERTY_NONE,  0                     },
     268           0 :         { OUString("PrinterSetup")                     , HANDLE_PRINTER_SETUP                      ,  ::getCppuType((const Sequence < sal_Int8 >*)0),                         PROPERTY_NONE,  0                     },
     269           0 :         { OUString("RelativeBracketDistance")          , HANDLE_RELATIVE_BRACKET_DISTANCE          ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_BRACKETSPACE      },
     270           0 :         { OUString("RelativeBracketExcessSize")        , HANDLE_RELATIVE_BRACKET_EXCESS_SIZE       ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_BRACKETSIZE       },
     271           0 :         { OUString("RelativeFontHeightFunctions")      , HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS     ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  SIZ_FUNCTION          },
     272           0 :         { OUString("RelativeFontHeightIndices")        , HANDLE_RELATIVE_FONT_HEIGHT_INDICES       ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  SIZ_INDEX             },
     273           0 :         { OUString("RelativeFontHeightLimits")         , HANDLE_RELATIVE_FONT_HEIGHT_LIMITS        ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  SIZ_LIMITS            },
     274           0 :         { OUString("RelativeFontHeightOperators")      , HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS     ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  SIZ_OPERATOR          },
     275           0 :         { OUString("RelativeFontHeightText")           , HANDLE_RELATIVE_FONT_HEIGHT_TEXT          ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  SIZ_TEXT              },
     276           0 :         { OUString("RelativeFractionBarExcessLength")  , HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_FRACTION          },
     277           0 :         { OUString("RelativeFractionBarLineWeight")    , HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT  ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_STROKEWIDTH       },
     278           0 :         { OUString("RelativeFractionDenominatorDepth") , HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_DENOMINATOR       },
     279           0 :         { OUString("RelativeFractionNumeratorHeight")  , HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_NUMERATOR         },
     280           0 :         { OUString("RelativeIndexSubscript")           , HANDLE_RELATIVE_INDEX_SUBSCRIPT           ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_SUBSCRIPT         },
     281           0 :         { OUString("RelativeIndexSuperscript")         , HANDLE_RELATIVE_INDEX_SUPERSCRIPT         ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_SUPERSCRIPT       },
     282           0 :         { OUString("RelativeLineSpacing")              , HANDLE_RELATIVE_LINE_SPACING              ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_VERTICAL          },
     283           0 :         { OUString("RelativeLowerLimitDistance")       , HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE      ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_LOWERLIMIT        },
     284           0 :         { OUString("RelativeMatrixColumnSpacing")      , HANDLE_RELATIVE_MATRIX_COLUMN_SPACING     ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_MATRIXCOL         },
     285           0 :         { OUString("RelativeMatrixLineSpacing")        , HANDLE_RELATIVE_MATRIX_LINE_SPACING       ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_MATRIXROW         },
     286           0 :         { OUString("RelativeOperatorExcessSize")       , HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE      ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_OPERATORSIZE      },
     287           0 :         { OUString("RelativeOperatorSpacing")          , HANDLE_RELATIVE_OPERATOR_SPACING          ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_OPERATORSPACE     },
     288           0 :         { OUString("RelativeRootSpacing")              , HANDLE_RELATIVE_ROOT_SPACING              ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_ROOT              },
     289           0 :         { OUString("RelativeScaleBracketExcessSize")   , HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_NORMALBRACKETSIZE },
     290           0 :         { OUString("RelativeSpacing")                  , HANDLE_RELATIVE_SPACING                   ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_HORIZONTAL        },
     291           0 :         { OUString("RelativeSymbolMinimumHeight")      , HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT     ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_ORNAMENTSPACE     },
     292           0 :         { OUString("RelativeSymbolPrimaryHeight")      , HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT     ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_ORNAMENTSIZE      },
     293           0 :         { OUString("RelativeUpperLimitDistance")       , HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE      ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_UPPERLIMIT        },
     294           0 :         { OUString("RightMargin")                      , HANDLE_RIGHT_MARGIN                       ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_RIGHTSPACE        },
     295           0 :         { OUString("RuntimeUID")                       , HANDLE_RUNTIME_UID                        ,  ::getCppuType(static_cast< const OUString * >(0)),                      PropertyAttribute::READONLY,  0       },
     296           0 :         { OUString("Symbols")                          , HANDLE_SYMBOLS                            ,  ::getCppuType((const Sequence < SymbolDescriptor > *)0),                PROPERTY_NONE,  0                     },
     297           0 :         { OUString("UserDefinedSymbolsInUse")          , HANDLE_USED_SYMBOLS                       ,  ::getCppuType((const Sequence < SymbolDescriptor > *)0),                PropertyAttribute::READONLY,  0       },
     298           0 :         { OUString("TopMargin")                        , HANDLE_TOP_MARGIN                         ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  DIS_TOPSPACE          },
     299             :         // #i33095# Security Options
     300           0 :         { OUString("LoadReadonly")                     , HANDLE_LOAD_READONLY                      ,  ::getBooleanCppuType(),                                                 PROPERTY_NONE,  0                     },
     301             :         // #i972#
     302           0 :         { OUString("BaseLine")                         , HANDLE_BASELINE                           ,  ::getCppuType((const sal_Int16*)0),                                     PROPERTY_NONE,  0                     },
     303           0 :         { OUString("InteropGrabBag")                   , HANDLE_INTEROP_GRAB_BAG                   ,  ::getCppuType((uno::Sequence< beans::PropertyValue >*)0),       PROPERTY_NONE,  0                     },
     304             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     305           0 :     };
     306           0 :     PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap );
     307           0 :     return pInfo;
     308             : }
     309             : 
     310           0 : SmModel::SmModel( SfxObjectShell *pObjSh )
     311             : : SfxBaseModel(pObjSh)
     312             : , PropertySetHelper ( lcl_createModelPropertyInfo () )
     313           0 : , m_pPrintUIOptions( NULL )
     314             : 
     315             : {
     316           0 : }
     317             : 
     318           0 : SmModel::~SmModel() throw ()
     319             : {
     320           0 :     delete m_pPrintUIOptions;
     321           0 : }
     322             : 
     323           0 : uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException, std::exception)
     324             : {
     325             :     uno::Any aRet =  ::cppu::queryInterface ( rType,
     326             :                                     // OWeakObject interfaces
     327             :                                     dynamic_cast< XInterface* > ( static_cast< XUnoTunnel* > ( this )),
     328             :                                     static_cast< XWeak* > ( this ),
     329             :                                     // PropertySetHelper interfaces
     330             :                                     static_cast< XPropertySet* > ( this ),
     331             :                                     static_cast< XMultiPropertySet* > ( this ),
     332             :                                     //static_cast< XPropertyState* > ( this ),
     333             :                                     // my own interfaces
     334             :                                     static_cast< XServiceInfo*  > ( this ),
     335           0 :                                     static_cast< XRenderable*  > ( this ) );
     336           0 :     if (!aRet.hasValue())
     337           0 :         aRet = SfxBaseModel::queryInterface ( rType );
     338           0 :     return aRet;
     339             : }
     340             : 
     341           0 : void SAL_CALL SmModel::acquire() throw()
     342             : {
     343           0 :     OWeakObject::acquire();
     344           0 : }
     345             : 
     346           0 : void SAL_CALL SmModel::release() throw()
     347             : {
     348           0 :     OWeakObject::release();
     349           0 : }
     350             : 
     351           0 : uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes(  ) throw(uno::RuntimeException, std::exception)
     352             : {
     353           0 :     SolarMutexGuard aGuard;
     354           0 :     uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes();
     355           0 :     sal_Int32 nLen = aTypes.getLength();
     356           0 :     aTypes.realloc(nLen + 4);
     357           0 :     uno::Type* pTypes = aTypes.getArray();
     358           0 :     pTypes[nLen++] = ::getCppuType((Reference<XServiceInfo>*)0);
     359           0 :     pTypes[nLen++] = ::getCppuType((Reference<XPropertySet>*)0);
     360           0 :     pTypes[nLen++] = ::getCppuType((Reference<XMultiPropertySet>*)0);
     361           0 :     pTypes[nLen++] = ::getCppuType((Reference<XRenderable>*)0);
     362             : 
     363           0 :     return aTypes;
     364             : }
     365             : 
     366             : namespace
     367             : {
     368             :     class theSmModelUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSmModelUnoTunnelId> {};
     369             : }
     370             : 
     371           0 : const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId()
     372             : {
     373           0 :     return theSmModelUnoTunnelId::get().getSeq();
     374             : }
     375             : 
     376           0 : sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId )
     377             :     throw(uno::RuntimeException, std::exception)
     378             : {
     379           0 :     if( rId.getLength() == 16
     380           0 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
     381           0 :                                         rId.getConstArray(), 16 ) )
     382             :     {
     383           0 :             return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
     384             :     }
     385             : 
     386           0 :     return SfxBaseModel::getSomething( rId );
     387             : }
     388             : 
     389           0 : static sal_Int16 lcl_AnyToINT16(const uno::Any& rAny)
     390             : {
     391           0 :     uno::TypeClass eType = rAny.getValueType().getTypeClass();
     392             : 
     393           0 :     sal_Int16 nRet = 0;
     394           0 :     if( eType == uno::TypeClass_DOUBLE )
     395           0 :         nRet = (sal_Int16)*(double*)rAny.getValue();
     396           0 :     else if( eType == uno::TypeClass_FLOAT )
     397           0 :         nRet = (sal_Int16)*(float*)rAny.getValue();
     398             :     else
     399           0 :         rAny >>= nRet;
     400           0 :     return nRet;
     401             : }
     402             : 
     403           0 : OUString SmModel::getImplementationName(void) throw( uno::RuntimeException, std::exception )
     404             : {
     405           0 :     return getImplementationName_Static();
     406             : }
     407             : 
     408             : 
     409           0 : OUString SmModel::getImplementationName_Static()
     410             : {
     411           0 :     return OUString("com.sun.star.comp.math.FormulaDocument");
     412             : }
     413             : 
     414           0 : sal_Bool SmModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
     415             : {
     416           0 :     return cppu::supportsService(this, rServiceName);
     417             : }
     418             : 
     419           0 : uno::Sequence< OUString > SmModel::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
     420             : {
     421           0 :     return getSupportedServiceNames_Static();
     422             : }
     423             : 
     424           0 : uno::Sequence< OUString > SmModel::getSupportedServiceNames_Static(void)
     425             : {
     426           0 :     SolarMutexGuard aGuard;
     427             : 
     428           0 :     uno::Sequence< OUString > aRet(2);
     429           0 :     OUString* pArray = aRet.getArray();
     430           0 :     pArray[0] = "com.sun.star.document.OfficeDocument";
     431           0 :     pArray[1] = "com.sun.star.formula.FormulaProperties";
     432           0 :     return aRet;
     433             : }
     434             : 
     435           0 : void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pValues)
     436             :     throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException)
     437             : {
     438           0 :     SolarMutexGuard aGuard;
     439             : 
     440           0 :     SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell());
     441             : 
     442           0 :     if ( NULL == pDocSh )
     443           0 :         throw UnknownPropertyException();
     444             : 
     445           0 :     SmFormat aFormat = pDocSh->GetFormat();
     446             : 
     447           0 :     for (; *ppEntries; ppEntries++, pValues++ )
     448             :     {
     449           0 :         if ((*ppEntries)->mnAttributes & PropertyAttribute::READONLY)
     450           0 :             throw PropertyVetoException();
     451             : 
     452           0 :         switch ( (*ppEntries)->mnHandle )
     453             :         {
     454             :             case HANDLE_FORMULA:
     455             :             {
     456           0 :                 OUString aText;
     457           0 :                 *pValues >>= aText;
     458           0 :                 pDocSh->SetText(aText);
     459             :             }
     460           0 :             break;
     461             :             case HANDLE_FONT_NAME_VARIABLES                :
     462             :             case HANDLE_FONT_NAME_FUNCTIONS                :
     463             :             case HANDLE_FONT_NAME_NUMBERS                  :
     464             :             case HANDLE_FONT_NAME_TEXT                     :
     465             :             case HANDLE_CUSTOM_FONT_NAME_SERIF             :
     466             :             case HANDLE_CUSTOM_FONT_NAME_SANS              :
     467             :             case HANDLE_CUSTOM_FONT_NAME_FIXED             :
     468             :             {
     469           0 :                 OUString sFontName;
     470           0 :                 *pValues >>= sFontName;
     471           0 :                 if(sFontName.isEmpty())
     472           0 :                     throw IllegalArgumentException();
     473             : 
     474           0 :                 if(OUString(aFormat.GetFont((*ppEntries)->mnMemberId).GetName()) != sFontName)
     475             :                 {
     476           0 :                     const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId);
     477             : 
     478           0 :                     SmFace aSet( sFontName, rOld.GetSize() );
     479           0 :                     aSet.SetBorderWidth( rOld.GetBorderWidth() );
     480           0 :                     aSet.SetAlign( ALIGN_BASELINE );
     481           0 :                     aFormat.SetFont( (*ppEntries)->mnMemberId, aSet );
     482           0 :                 }
     483             :             }
     484           0 :             break;
     485             :             case HANDLE_CUSTOM_FONT_FIXED_POSTURE:
     486             :             case HANDLE_CUSTOM_FONT_SANS_POSTURE :
     487             :             case HANDLE_CUSTOM_FONT_SERIF_POSTURE:
     488             :             case HANDLE_FONT_VARIABLES_POSTURE   :
     489             :             case HANDLE_FONT_FUNCTIONS_POSTURE   :
     490             :             case HANDLE_FONT_NUMBERS_POSTURE     :
     491             :             case HANDLE_FONT_TEXT_POSTURE        :
     492             :             {
     493           0 :                 if((*pValues).getValueType() != ::getBooleanCppuType())
     494           0 :                     throw IllegalArgumentException();
     495           0 :                 bool bVal = *(sal_Bool*)(*pValues).getValue();
     496           0 :                 Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId));
     497           0 :                 aNewFont.SetItalic((bVal) ? ITALIC_NORMAL : ITALIC_NONE);
     498           0 :                 aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont);
     499             :             }
     500           0 :             break;
     501             :             case HANDLE_CUSTOM_FONT_FIXED_WEIGHT :
     502             :             case HANDLE_CUSTOM_FONT_SANS_WEIGHT  :
     503             :             case HANDLE_CUSTOM_FONT_SERIF_WEIGHT :
     504             :             case HANDLE_FONT_VARIABLES_WEIGHT    :
     505             :             case HANDLE_FONT_FUNCTIONS_WEIGHT    :
     506             :             case HANDLE_FONT_NUMBERS_WEIGHT      :
     507             :             case HANDLE_FONT_TEXT_WEIGHT         :
     508             :             {
     509           0 :                 if((*pValues).getValueType() != ::getBooleanCppuType())
     510           0 :                     throw IllegalArgumentException();
     511           0 :                 bool bVal = *(sal_Bool*)(*pValues).getValue();
     512           0 :                 Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId));
     513           0 :                 aNewFont.SetWeight((bVal) ? WEIGHT_BOLD : WEIGHT_NORMAL);
     514           0 :                 aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont);
     515             :             }
     516           0 :             break;
     517             :             case HANDLE_BASE_FONT_HEIGHT                   :
     518             :             {
     519             :                 // Point!
     520           0 :                 sal_Int16 nVal = lcl_AnyToINT16(*pValues);
     521           0 :                 if(nVal < 1)
     522           0 :                     throw IllegalArgumentException();
     523           0 :                 Size aSize = aFormat.GetBaseSize();
     524           0 :                 nVal *= 20;
     525           0 :                 nVal = static_cast < sal_Int16 > ( convertTwipToMm100(nVal) );
     526           0 :                 aSize.Height() = nVal;
     527           0 :                 aFormat.SetBaseSize(aSize);
     528             : 
     529             :                 // apply base size to fonts
     530           0 :                 const Size aTmp( aFormat.GetBaseSize() );
     531           0 :                 for (sal_uInt16  i = FNT_BEGIN;  i <= FNT_END;  i++)
     532           0 :                     aFormat.SetFontSize(i, aTmp);
     533             :             }
     534           0 :             break;
     535             :             case HANDLE_RELATIVE_FONT_HEIGHT_TEXT          :
     536             :             case HANDLE_RELATIVE_FONT_HEIGHT_INDICES       :
     537             :             case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS     :
     538             :             case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS     :
     539             :             case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS        :
     540             :             {
     541           0 :                 sal_Int16 nVal = 0;
     542           0 :                 *pValues >>= nVal;
     543           0 :                 if(nVal < 1)
     544           0 :                     throw IllegalArgumentException();
     545           0 :                 aFormat.SetRelSize((*ppEntries)->mnMemberId, nVal);
     546             :             }
     547           0 :             break;
     548             : 
     549             :             case HANDLE_IS_TEXT_MODE                       :
     550             :             {
     551           0 :                 aFormat.SetTextmode(*(sal_Bool*)(*pValues).getValue());
     552             :             }
     553           0 :             break;
     554             : 
     555             :             case HANDLE_GREEK_CHAR_STYLE                    :
     556             :             {
     557           0 :                 sal_Int16 nVal = 0;
     558           0 :                 *pValues >>= nVal;
     559           0 :                 if (nVal < 0 || nVal > 2)
     560           0 :                     throw IllegalArgumentException();
     561           0 :                 aFormat.SetGreekCharStyle( nVal );
     562             :             }
     563           0 :             break;
     564             : 
     565             :             case HANDLE_ALIGNMENT                          :
     566             :             {
     567             :                 // SmHorAlign uses the same values as HorizontalAlignment
     568           0 :                 sal_Int16 nVal = 0;
     569           0 :                 *pValues >>= nVal;
     570           0 :                 if(nVal < 0 || nVal > 2)
     571           0 :                     throw IllegalArgumentException();
     572           0 :                 aFormat.SetHorAlign((SmHorAlign)nVal);
     573             :             }
     574           0 :             break;
     575             : 
     576             :             case HANDLE_RELATIVE_SPACING                   :
     577             :             case HANDLE_RELATIVE_LINE_SPACING              :
     578             :             case HANDLE_RELATIVE_ROOT_SPACING              :
     579             :             case HANDLE_RELATIVE_INDEX_SUPERSCRIPT         :
     580             :             case HANDLE_RELATIVE_INDEX_SUBSCRIPT           :
     581             :             case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT :
     582             :             case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH:
     583             :             case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH:
     584             :             case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT  :
     585             :             case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE      :
     586             :             case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE      :
     587             :             case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE       :
     588             :             case HANDLE_RELATIVE_BRACKET_DISTANCE          :
     589             :             case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE :
     590             :             case HANDLE_RELATIVE_MATRIX_LINE_SPACING       :
     591             :             case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING     :
     592             :             case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT     :
     593             :             case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT     :
     594             :             case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE      :
     595             :             case HANDLE_RELATIVE_OPERATOR_SPACING          :
     596             :             case HANDLE_LEFT_MARGIN               :
     597             :             case HANDLE_RIGHT_MARGIN              :
     598             :             case HANDLE_TOP_MARGIN                :
     599             :             case HANDLE_BOTTOM_MARGIN             :
     600             :             {
     601           0 :                 sal_Int16 nVal = 0;
     602           0 :                 *pValues >>= nVal;
     603           0 :                 if(nVal < 0)
     604           0 :                     throw IllegalArgumentException();
     605           0 :                 aFormat.SetDistance((*ppEntries)->mnMemberId, nVal);
     606             :             }
     607           0 :             break;
     608             :             case HANDLE_IS_SCALE_ALL_BRACKETS              :
     609           0 :                 aFormat.SetScaleNormalBrackets(*(sal_Bool*)(*pValues).getValue());
     610           0 :             break;
     611             :             case HANDLE_PRINTER_NAME:
     612             :             {
     613             :                 // embedded documents just ignore this property for now
     614           0 :                 if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
     615             :                 {
     616           0 :                     SfxPrinter *pPrinter = pDocSh->GetPrinter ( );
     617           0 :                     if (pPrinter)
     618             :                     {
     619           0 :                         OUString sPrinterName;
     620           0 :                         if (*pValues >>= sPrinterName )
     621             :                         {
     622           0 :                             if ( !sPrinterName.isEmpty() )
     623             :                             {
     624           0 :                                 SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
     625           0 :                                 if (pNewPrinter->IsKnown())
     626           0 :                                     pDocSh->SetPrinter ( pNewPrinter );
     627             :                                 else
     628           0 :                                     delete pNewPrinter;
     629             :                             }
     630             :                         }
     631             :                         else
     632           0 :                             throw IllegalArgumentException();
     633             :                     }
     634             :                 }
     635             :             }
     636           0 :             break;
     637             :             case HANDLE_PRINTER_SETUP:
     638             :             {
     639           0 :                 Sequence < sal_Int8 > aSequence;
     640           0 :                 if ( *pValues >>= aSequence )
     641             :                 {
     642           0 :                     sal_uInt32 nSize = aSequence.getLength();
     643           0 :                     SvMemoryStream aStream ( aSequence.getArray(), nSize, STREAM_READ );
     644           0 :                     aStream.Seek ( STREAM_SEEK_TO_BEGIN );
     645             :                     static sal_uInt16 const nRange[] =
     646             :                     {
     647             :                         SID_PRINTSIZE,       SID_PRINTSIZE,
     648             :                         SID_PRINTZOOM,       SID_PRINTZOOM,
     649             :                         SID_PRINTTITLE,      SID_PRINTTITLE,
     650             :                         SID_PRINTTEXT,       SID_PRINTTEXT,
     651             :                         SID_PRINTFRAME,      SID_PRINTFRAME,
     652             :                         SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
     653             :                         SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
     654             :                         0
     655             :                     };
     656           0 :                     SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange );
     657           0 :                     SmModule *pp = SM_MOD();
     658           0 :                     pp->GetConfig()->ConfigToItemSet(*pItemSet);
     659           0 :                     SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
     660             : 
     661           0 :                     pDocSh->SetPrinter( pPrinter );
     662             :                 }
     663             :                 else
     664           0 :                     throw IllegalArgumentException();
     665             :             }
     666           0 :             break;
     667             :             case HANDLE_SYMBOLS:
     668             :             {
     669             :                 // this is set
     670           0 :                 Sequence < SymbolDescriptor > aSequence;
     671           0 :                 if ( *pValues >>= aSequence )
     672             :                 {
     673           0 :                     sal_uInt32 nSize = aSequence.getLength();
     674           0 :                     SmModule *pp = SM_MOD();
     675           0 :                     SmSymbolManager &rManager = pp->GetSymbolManager();
     676           0 :                     SymbolDescriptor *pDescriptor = aSequence.getArray();
     677           0 :                     for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++)
     678             :                     {
     679           0 :                         Font aFont;
     680           0 :                         aFont.SetName ( pDescriptor->sFontName );
     681           0 :                         aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) );
     682           0 :                         aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) );
     683           0 :                         aFont.SetPitch  ( static_cast < FontPitch >  (pDescriptor->nPitch ) );
     684           0 :                         aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) );
     685           0 :                         aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) );
     686             :                         SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter),
     687           0 :                                         pDescriptor->sSymbolSet );
     688           0 :                         aSymbol.SetExportName ( pDescriptor->sExportName );
     689           0 :                         aSymbol.SetDocSymbol( true );
     690           0 :                         rManager.AddOrReplaceSymbol ( aSymbol );
     691           0 :                     }
     692             :                 }
     693             :                 else
     694           0 :                     throw IllegalArgumentException();
     695             :             }
     696           0 :             break;
     697             :             // #i33095# Security Options
     698             :             case HANDLE_LOAD_READONLY :
     699             :             {
     700           0 :                 if ( (*pValues).getValueType() != ::getBooleanCppuType() )
     701           0 :                     throw IllegalArgumentException();
     702           0 :                 sal_Bool bReadonly = sal_False;
     703           0 :                 if ( *pValues >>= bReadonly )
     704           0 :                     pDocSh->SetLoadReadonly( bReadonly );
     705           0 :                 break;
     706             :             }
     707             :             case HANDLE_INTEROP_GRAB_BAG:
     708           0 :                 setGrabBagItem(*pValues);
     709           0 :             break;
     710             :         }
     711             :     }
     712             : 
     713           0 :     pDocSh->SetFormat( aFormat );
     714             : 
     715             :     // #i67283# since about all of the above changes are likely to change
     716             :     // the formula size we have to recalculate the vis-area now
     717           0 :     pDocSh->SetVisArea( Rectangle( Point(0, 0), pDocSh->GetSize() ) );
     718           0 : }
     719             : 
     720           0 : void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue )
     721             :     throw( UnknownPropertyException, WrappedTargetException )
     722             : {
     723           0 :     SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell());
     724             : 
     725           0 :     if ( NULL == pDocSh )
     726           0 :         throw UnknownPropertyException();
     727             : 
     728           0 :     const SmFormat & aFormat = pDocSh->GetFormat();
     729             : 
     730           0 :     for (; *ppEntries; ppEntries++, pValue++ )
     731             :     {
     732           0 :         switch ( (*ppEntries)->mnHandle )
     733             :         {
     734             :             case HANDLE_FORMULA:
     735           0 :                 *pValue <<= OUString(pDocSh->GetText());
     736           0 :             break;
     737             :             case HANDLE_FONT_NAME_VARIABLES                :
     738             :             case HANDLE_FONT_NAME_FUNCTIONS                :
     739             :             case HANDLE_FONT_NAME_NUMBERS                  :
     740             :             case HANDLE_FONT_NAME_TEXT                     :
     741             :             case HANDLE_CUSTOM_FONT_NAME_SERIF             :
     742             :             case HANDLE_CUSTOM_FONT_NAME_SANS              :
     743             :             case HANDLE_CUSTOM_FONT_NAME_FIXED             :
     744             :             {
     745           0 :                 const SmFace &  rFace = aFormat.GetFont((*ppEntries)->mnMemberId);
     746           0 :                 *pValue <<= OUString(rFace.GetName());
     747             :             }
     748           0 :             break;
     749             :             case HANDLE_CUSTOM_FONT_FIXED_POSTURE:
     750             :             case HANDLE_CUSTOM_FONT_SANS_POSTURE :
     751             :             case HANDLE_CUSTOM_FONT_SERIF_POSTURE:
     752             :             case HANDLE_FONT_VARIABLES_POSTURE   :
     753             :             case HANDLE_FONT_FUNCTIONS_POSTURE   :
     754             :             case HANDLE_FONT_NUMBERS_POSTURE     :
     755             :             case HANDLE_FONT_TEXT_POSTURE        :
     756             :             {
     757           0 :                 const SmFace &  rFace = aFormat.GetFont((*ppEntries)->mnMemberId);
     758           0 :                 bool bVal = IsItalic( rFace );
     759           0 :                 (*pValue).setValue(&bVal, (*ppEntries)->maType);
     760             :             }
     761           0 :             break;
     762             :             case HANDLE_CUSTOM_FONT_FIXED_WEIGHT :
     763             :             case HANDLE_CUSTOM_FONT_SANS_WEIGHT  :
     764             :             case HANDLE_CUSTOM_FONT_SERIF_WEIGHT :
     765             :             case HANDLE_FONT_VARIABLES_WEIGHT    :
     766             :             case HANDLE_FONT_FUNCTIONS_WEIGHT    :
     767             :             case HANDLE_FONT_NUMBERS_WEIGHT      :
     768             :             case HANDLE_FONT_TEXT_WEIGHT         :
     769             :             {
     770           0 :                 const SmFace &  rFace = aFormat.GetFont((*ppEntries)->mnMemberId);
     771           0 :                 bool bVal = IsBold( rFace ); // bold?
     772           0 :                 (*pValue).setValue(&bVal, (*ppEntries)->maType);
     773             :             }
     774           0 :             break;
     775             :             case HANDLE_BASE_FONT_HEIGHT                   :
     776             :             {
     777             :                 // Point!
     778           0 :                 sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height());
     779           0 :                 nVal = static_cast < sal_Int16 > (convertMm100ToTwip(nVal));
     780           0 :                 nVal = (nVal + 10) / 20;
     781           0 :                 *pValue <<= nVal;
     782             :             }
     783           0 :             break;
     784             :             case HANDLE_RELATIVE_FONT_HEIGHT_TEXT           :
     785             :             case HANDLE_RELATIVE_FONT_HEIGHT_INDICES       :
     786             :             case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS     :
     787             :             case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS     :
     788             :             case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS        :
     789           0 :                 *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId);
     790           0 :             break;
     791             : 
     792             :             case HANDLE_IS_TEXT_MODE                       :
     793             :             {
     794           0 :                 sal_Bool bVal = aFormat.IsTextmode();
     795           0 :                 (*pValue).setValue(&bVal, ::getBooleanCppuType());
     796             :             }
     797           0 :             break;
     798             : 
     799             :             case HANDLE_GREEK_CHAR_STYLE                    :
     800           0 :                 *pValue <<= (sal_Int16)aFormat.GetGreekCharStyle();
     801           0 :             break;
     802             : 
     803             :             case HANDLE_ALIGNMENT                          :
     804             :                 // SmHorAlign uses the same values as HorizontalAlignment
     805           0 :                 *pValue <<= (sal_Int16)aFormat.GetHorAlign();
     806           0 :             break;
     807             : 
     808             :             case HANDLE_RELATIVE_SPACING                   :
     809             :             case HANDLE_RELATIVE_LINE_SPACING              :
     810             :             case HANDLE_RELATIVE_ROOT_SPACING              :
     811             :             case HANDLE_RELATIVE_INDEX_SUPERSCRIPT         :
     812             :             case HANDLE_RELATIVE_INDEX_SUBSCRIPT           :
     813             :             case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT :
     814             :             case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH:
     815             :             case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH:
     816             :             case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT  :
     817             :             case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE      :
     818             :             case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE      :
     819             :             case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE       :
     820             :             case HANDLE_RELATIVE_BRACKET_DISTANCE          :
     821             :             case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE :
     822             :             case HANDLE_RELATIVE_MATRIX_LINE_SPACING       :
     823             :             case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING     :
     824             :             case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT     :
     825             :             case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT     :
     826             :             case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE      :
     827             :             case HANDLE_RELATIVE_OPERATOR_SPACING          :
     828             :             case HANDLE_LEFT_MARGIN               :
     829             :             case HANDLE_RIGHT_MARGIN              :
     830             :             case HANDLE_TOP_MARGIN                :
     831             :             case HANDLE_BOTTOM_MARGIN             :
     832           0 :                 *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId);
     833           0 :             break;
     834             :             case HANDLE_IS_SCALE_ALL_BRACKETS              :
     835             :             {
     836           0 :                 sal_Bool bVal = aFormat.IsScaleNormalBrackets();
     837           0 :                 (*pValue).setValue(&bVal, ::getBooleanCppuType());
     838             :             }
     839           0 :             break;
     840             :             case HANDLE_PRINTER_NAME:
     841             :             {
     842           0 :                 SfxPrinter *pPrinter = pDocSh->GetPrinter ( );
     843           0 :                 *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString();
     844             :             }
     845           0 :             break;
     846             :             case HANDLE_PRINTER_SETUP:
     847             :             {
     848           0 :                 SfxPrinter *pPrinter = pDocSh->GetPrinter ();
     849           0 :                 if (pPrinter)
     850             :                 {
     851           0 :                     SvMemoryStream aStream;
     852           0 :                     pPrinter->Store( aStream );
     853           0 :                     aStream.Seek ( STREAM_SEEK_TO_END );
     854           0 :                     sal_uInt32 nSize = aStream.Tell();
     855           0 :                     aStream.Seek ( STREAM_SEEK_TO_BEGIN );
     856           0 :                     Sequence < sal_Int8 > aSequence ( nSize );
     857           0 :                     aStream.Read ( aSequence.getArray(), nSize );
     858           0 :                     *pValue <<= aSequence;
     859             :                 }
     860             :             }
     861           0 :             break;
     862             :             case HANDLE_SYMBOLS:
     863             :             case HANDLE_USED_SYMBOLS:
     864             :             {
     865           0 :                 const bool bUsedSymbolsOnly = (*ppEntries)->mnHandle == HANDLE_USED_SYMBOLS;
     866           0 :                 const std::set< OUString > &rUsedSymbols = pDocSh->GetUsedSymbols();
     867             : 
     868             :                 // this is get
     869           0 :                 SmModule *pp = SM_MOD();
     870           0 :                 const SmSymbolManager &rManager = pp->GetSymbolManager();
     871           0 :                 vector < const SmSym * > aVector;
     872             : 
     873           0 :                 const SymbolPtrVec_t aSymbols( rManager.GetSymbols() );
     874           0 :                 size_t nCount = 0;
     875           0 :                 for (size_t i = 0; i < aSymbols.size(); ++i)
     876             :                 {
     877           0 :                     const SmSym * pSymbol = aSymbols[ i ];
     878           0 :                     if (pSymbol && !pSymbol->IsPredefined() &&
     879           0 :                         (!bUsedSymbolsOnly ||
     880           0 :                          rUsedSymbols.find( pSymbol->GetName() ) != rUsedSymbols.end()))
     881             :                     {
     882           0 :                         aVector.push_back ( pSymbol );
     883           0 :                         nCount++;
     884             :                     }
     885             :                 }
     886           0 :                 Sequence < SymbolDescriptor > aSequence ( nCount );
     887           0 :                 SymbolDescriptor * pDescriptor = aSequence.getArray();
     888             : 
     889           0 :                 vector < const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end();
     890           0 :                 for(; aIter != aEnd; pDescriptor++, ++aIter)
     891             :                 {
     892           0 :                     pDescriptor->sName = (*aIter)->GetName();
     893           0 :                     pDescriptor->sExportName = (*aIter)->GetExportName();
     894           0 :                     pDescriptor->sSymbolSet = (*aIter)->GetSymbolSetName();
     895           0 :                     pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter());
     896             : 
     897           0 :                     Font rFont = (*aIter)->GetFace();
     898           0 :                     pDescriptor->sFontName = rFont.GetName();
     899           0 :                     pDescriptor->nCharSet  = sal::static_int_cast< sal_Int16 >(rFont.GetCharSet());
     900           0 :                     pDescriptor->nFamily   = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
     901           0 :                     pDescriptor->nPitch    = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
     902           0 :                     pDescriptor->nWeight   = sal::static_int_cast< sal_Int16 >(rFont.GetWeight());
     903           0 :                     pDescriptor->nItalic   = sal::static_int_cast< sal_Int16 >(rFont.GetItalic());
     904           0 :                 }
     905           0 :                 *pValue <<= aSequence;
     906             :             }
     907           0 :             break;
     908             :             case HANDLE_BASIC_LIBRARIES:
     909           0 :                 *pValue <<= pDocSh->GetBasicContainer();
     910           0 :             break;
     911             :             case HANDLE_DIALOG_LIBRARIES:
     912           0 :                 *pValue <<= pDocSh->GetDialogContainer();
     913           0 :             break;
     914             :             case HANDLE_RUNTIME_UID:
     915           0 :                 *pValue <<= getRuntimeUID();
     916           0 :             break;
     917             :             // #i33095# Security Options
     918             :             case HANDLE_LOAD_READONLY :
     919             :             {
     920           0 :                  *pValue <<= pDocSh->IsLoadReadonly();
     921           0 :                 break;
     922             :             }
     923             :             // #i972#
     924             :             case HANDLE_BASELINE:
     925             :             {
     926           0 :                 if ( !pDocSh->pTree )
     927           0 :                     pDocSh->Parse();
     928           0 :                 if ( pDocSh->pTree )
     929             :                 {
     930           0 :                     if ( !pDocSh->IsFormulaArranged() )
     931           0 :                         pDocSh->ArrangeFormula();
     932             : 
     933           0 :                     *pValue <<= static_cast<sal_Int32>( pDocSh->pTree->GetFormulaBaseline() );
     934             :                 }
     935           0 :                 break;
     936             :             }
     937             :             case HANDLE_INTEROP_GRAB_BAG:
     938           0 :                 getGrabBagItem(*pValue);
     939           0 :             break;
     940             :         }
     941             :     }
     942           0 : }
     943             : 
     944             : 
     945             : 
     946           0 : sal_Int32 SAL_CALL SmModel::getRendererCount(
     947             :         const uno::Any& /*rSelection*/,
     948             :         const uno::Sequence< beans::PropertyValue >& /*xOptions*/ )
     949             :     throw (IllegalArgumentException, RuntimeException, std::exception)
     950             : {
     951           0 :     SolarMutexGuard aGuard;
     952           0 :     return 1;
     953             : }
     954             : 
     955             : 
     956           0 : static Size lcl_GuessPaperSize()
     957             : {
     958           0 :     Size aRes;
     959           0 :     const LocaleDataWrapper& rLocWrp( AllSettings().GetLocaleDataWrapper() );
     960           0 :     if( MEASURE_METRIC == rLocWrp.getMeasurementSystemEnum() )
     961             :     {
     962             :         // in 100th mm
     963           0 :         PaperInfo aInfo( PAPER_A4 );
     964           0 :         aRes.Width()  = aInfo.getWidth();
     965           0 :         aRes.Height() = aInfo.getHeight();
     966             :     }
     967             :     else
     968             :     {
     969             :         // in 100th mm
     970           0 :         PaperInfo aInfo( PAPER_LETTER );
     971           0 :         aRes.Width()  = aInfo.getWidth();
     972           0 :         aRes.Height() = aInfo.getHeight();
     973             :     }
     974           0 :     return aRes;
     975             : }
     976             : 
     977           0 : uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
     978             :         sal_Int32 nRenderer,
     979             :         const uno::Any& /*rSelection*/,
     980             :         const uno::Sequence< beans::PropertyValue >& /*rxOptions*/ )
     981             :     throw (IllegalArgumentException, RuntimeException, std::exception)
     982             : {
     983           0 :     SolarMutexGuard aGuard;
     984             : 
     985           0 :     if (0 != nRenderer)
     986           0 :         throw IllegalArgumentException();
     987             : 
     988           0 :     SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() );
     989           0 :     if (!pDocSh)
     990           0 :         throw RuntimeException();
     991             : 
     992           0 :     SmPrinterAccess aPrinterAccess( *pDocSh );
     993           0 :     Printer *pPrinter = aPrinterAccess.GetPrinter();
     994           0 :     Size    aPrtPaperSize ( pPrinter->GetPaperSize() );
     995             : 
     996             :     // if paper size is 0 (usually if no 'real' printer is found),
     997             :     // guess the paper size
     998           0 :     if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0)
     999           0 :         aPrtPaperSize = lcl_GuessPaperSize();
    1000           0 :     awt::Size   aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
    1001             : 
    1002           0 :     uno::Sequence< beans::PropertyValue > aRenderer(1);
    1003           0 :     PropertyValue  &rValue = aRenderer.getArray()[0];
    1004           0 :     rValue.Name  = "PageSize";
    1005           0 :     rValue.Value <<= aPageSize;
    1006             : 
    1007           0 :     if (!m_pPrintUIOptions)
    1008           0 :         m_pPrintUIOptions = new SmPrintUIOptions();
    1009           0 :     m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
    1010             : 
    1011           0 :     return aRenderer;
    1012             : }
    1013             : 
    1014           0 : void SAL_CALL SmModel::render(
    1015             :         sal_Int32 nRenderer,
    1016             :         const uno::Any& rSelection,
    1017             :         const uno::Sequence< beans::PropertyValue >& rxOptions )
    1018             :     throw (IllegalArgumentException, RuntimeException, std::exception)
    1019             : {
    1020           0 :     SolarMutexGuard aGuard;
    1021             : 
    1022           0 :     if (0 != nRenderer)
    1023           0 :         throw IllegalArgumentException();
    1024             : 
    1025           0 :     SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() );
    1026           0 :     if (!pDocSh)
    1027           0 :         throw RuntimeException();
    1028             : 
    1029             :     // get device to be rendered in
    1030           0 :     uno::Reference< awt::XDevice >  xRenderDevice;
    1031           0 :     for (sal_Int32 i = 0, nCount = rxOptions.getLength();  i < nCount;  ++i)
    1032             :     {
    1033           0 :         if( rxOptions[i].Name == "RenderDevice" )
    1034           0 :             rxOptions[i].Value >>= xRenderDevice;
    1035             :     }
    1036             : 
    1037           0 :     if (xRenderDevice.is())
    1038             :     {
    1039           0 :         VCLXDevice*   pDevice = VCLXDevice::GetImplementation( xRenderDevice );
    1040           0 :         OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
    1041             : 
    1042           0 :         if (!pOut)
    1043           0 :             throw RuntimeException();
    1044             : 
    1045           0 :         pOut->SetMapMode( MAP_100TH_MM );
    1046             : 
    1047           0 :         uno::Reference< frame::XModel > xModel;
    1048           0 :         rSelection >>= xModel;
    1049           0 :         if (xModel == pDocSh->GetModel())
    1050             :         {
    1051             :             //!! when called via API we may not have an active view
    1052             :             //!! thus we go and look for a view that can be used.
    1053           0 :             const TypeId aTypeId = TYPE( SmViewShell );
    1054           0 :             SfxViewShell* pViewSh = SfxViewShell::GetFirst( &aTypeId, false /* search non-visible views as well*/ );
    1055           0 :             while (pViewSh && pViewSh->GetObjectShell() != pDocSh)
    1056           0 :                 pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, false /* search non-visible views as well*/ );
    1057           0 :             SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh );
    1058             :             SAL_WARN_IF( !pView, "starmath", "SmModel::render : no SmViewShell found" );
    1059             : 
    1060           0 :             if (pView)
    1061             :             {
    1062           0 :                 SmPrinterAccess aPrinterAccess( *pDocSh );
    1063           0 :                 Printer *pPrinter = aPrinterAccess.GetPrinter();
    1064             : 
    1065           0 :                 Size    aPrtPaperSize ( pPrinter->GetPaperSize() );
    1066           0 :                 Size    aOutputSize   ( pPrinter->GetOutputSize() );
    1067           0 :                 Point   aPrtPageOffset( pPrinter->GetPageOffset() );
    1068             : 
    1069             :                 // no real printer ??
    1070           0 :                 if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0)
    1071             :                 {
    1072           0 :                     aPrtPaperSize = lcl_GuessPaperSize();
    1073             :                     // factors from Windows DIN A4
    1074           0 :                     aOutputSize    = Size( (long)(aPrtPaperSize.Width()  * 0.941),
    1075           0 :                                            (long)(aPrtPaperSize.Height() * 0.961));
    1076           0 :                     aPrtPageOffset = Point( (long)(aPrtPaperSize.Width()  * 0.0250),
    1077           0 :                                             (long)(aPrtPaperSize.Height() * 0.0214));
    1078             :                 }
    1079           0 :                 Point   aZeroPoint;
    1080           0 :                 Rectangle OutputRect( aZeroPoint, aOutputSize );
    1081             : 
    1082             : 
    1083             :                 // set minimum top and bottom border
    1084           0 :                 if (aPrtPageOffset.Y() < 2000)
    1085           0 :                     OutputRect.Top() += 2000 - aPrtPageOffset.Y();
    1086           0 :                 if ((aPrtPaperSize.Height() - (aPrtPageOffset.Y() + OutputRect.Bottom())) < 2000)
    1087           0 :                     OutputRect.Bottom() -= 2000 - (aPrtPaperSize.Height() -
    1088           0 :                                                 (aPrtPageOffset.Y() + OutputRect.Bottom()));
    1089             : 
    1090             :                 // set minimum left and right border
    1091           0 :                 if (aPrtPageOffset.X() < 2500)
    1092           0 :                     OutputRect.Left() += 2500 - aPrtPageOffset.X();
    1093           0 :                 if ((aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())) < 1500)
    1094           0 :                     OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() -
    1095           0 :                                                 (aPrtPageOffset.X() + OutputRect.Right()));
    1096             : 
    1097           0 :                 if (!m_pPrintUIOptions)
    1098           0 :                     m_pPrintUIOptions = new SmPrintUIOptions();
    1099           0 :                 m_pPrintUIOptions->processProperties( rxOptions );
    1100             : 
    1101           0 :                 pView->Impl_Print( *pOut, *m_pPrintUIOptions, Rectangle( OutputRect ), Point() );
    1102             : 
    1103             :                 // release SmPrintUIOptions when everything is done.
    1104             :                 // That way, when SmPrintUIOptions is needed again it will read the latest configuration settings in its c-tor.
    1105           0 :                 if (m_pPrintUIOptions->getBoolValue( "IsLastPage", false ))
    1106             :                 {
    1107           0 :                     delete m_pPrintUIOptions;   m_pPrintUIOptions = 0;
    1108           0 :                 }
    1109             :             }
    1110           0 :         }
    1111           0 :     }
    1112           0 : }
    1113             : 
    1114           0 : void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xParent)
    1115             :         throw( lang::NoSupportException, uno::RuntimeException, std::exception )
    1116             : {
    1117           0 :     SolarMutexGuard aGuard;
    1118           0 :     SfxBaseModel::setParent( xParent );
    1119           0 :     uno::Reference< lang::XUnoTunnel > xParentTunnel( xParent, uno::UNO_QUERY );
    1120           0 :     if ( xParentTunnel.is() )
    1121             :     {
    1122           0 :         SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID );
    1123           0 :         SfxObjectShell* pDoc = reinterpret_cast<SfxObjectShell *>(xParentTunnel->getSomething(
    1124           0 :                                         uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) );
    1125           0 :         if ( pDoc )
    1126           0 :             GetObjectShell()->OnDocumentPrinterChanged( pDoc->GetDocumentPrinter() );
    1127           0 :     }
    1128           0 : }
    1129             : 
    1130           0 : void SmModel::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version )
    1131             : {
    1132           0 :     static_cast< SmDocShell* >( GetObjectShell())->writeFormulaOoxml( m_pSerializer, version );
    1133           0 : }
    1134             : 
    1135           0 : void SmModel::writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding)
    1136             : {
    1137           0 :     static_cast<SmDocShell*>(GetObjectShell())->writeFormulaRtf(rBuffer, nEncoding);
    1138           0 : }
    1139             : 
    1140           0 : void SmModel::readFormulaOoxml( oox::formulaimport::XmlStream& stream )
    1141             : {
    1142           0 :     static_cast< SmDocShell* >( GetObjectShell())->readFormulaOoxml( stream );
    1143           0 : }
    1144             : 
    1145           0 : Size SmModel::getFormulaSize() const
    1146             : {
    1147           0 :     return static_cast< SmDocShell* >( GetObjectShell())->GetSize();
    1148           0 : }
    1149             : 
    1150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10