summaryrefslogtreecommitdiff
path: root/sw/source/ui/app/appopt.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/app/appopt.cxx')
-rw-r--r--sw/source/ui/app/appopt.cxx142
1 files changed, 44 insertions, 98 deletions
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
index ca39c1330790..6ab953e62193 100644
--- a/sw/source/ui/app/appopt.cxx
+++ b/sw/source/ui/app/appopt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,6 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <cmdid.h> // Function-Ids
#define _SVSTDARR_STRINGSDTOR
#include <svl/svstdarr.hxx>
@@ -58,8 +60,8 @@
#include <wrtsh.hxx>
#include <IDocumentDeviceAccess.hxx>
#include <uitool.hxx>
-#include <initui.hxx> // fuer ::GetGlossaries()
-#include <fldbas.hxx> //fuer UpdateFields
+#include <initui.hxx> // for ::GetGlossaries()
+#include <fldbas.hxx> //for UpdateFields
#include <wview.hxx>
#include <cfgitems.hxx>
#include <prtopt.hxx>
@@ -72,7 +74,7 @@
#include <unotools/lingucfg.hxx>
#include <editeng/unolingu.hxx>
#include <globals.hrc>
-#include <globals.h> // globale Konstanten z.B.
+#include <globals.h> // e.g. global Constants
#include <svl/slstitm.hxx>
#include "swabstdlg.hxx"
#include <swwrtshitem.hxx>
@@ -82,37 +84,31 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-/* -----------------12.02.99 12:28-------------------
- *
- * --------------------------------------------------*/
-
SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
{
sal_Bool bTextDialog = (nId == SID_SW_EDITOPTIONS) ? sal_True : sal_False;
- // hier werden die Optionen fuer die Web- und den Textdialog zusmmengesetzt
+ // the options for the Web- and Textdialog are put together here
SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
- //kein MakeUsrPref, da hier nur die Optionen von Textdoks genommen werden duerfen
+ // no MakeUsrPref, because only options from textdoks can be used here
SwView* pAppView = GetView();
if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
pAppView = 0;
if(pAppView)
{
- // wenn Text dann nicht WebView und umgekehrt
+ // if Text then no WebView and vice versa
sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
{
aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
}
else
- pAppView = 0; // mit View kann hier nichts gewonnen werden
+ pAppView = 0; // with View, there's nothing to win here
}
/********************************************************************/
- /* */
- /* Optionen/Bearbeiten */
- /* */
+ /* Options/Edit */
/********************************************************************/
SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM,
SID_PRINTPREVIEW, SID_PRINTPREVIEW,
@@ -121,6 +117,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
FN_PARAM_WRTSHELL, FN_PARAM_WRTSHELL,
FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
SID_ATTR_METRIC, SID_ATTR_METRIC,
+ SID_ATTR_APPLYCHARUNIT, SID_ATTR_APPLYCHARUNIT,
SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
RES_BACKGROUND, RES_BACKGROUND,
SID_HTML_MODE, SID_HTML_MODE,
@@ -130,7 +127,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
FN_PARAM_SWTEST, FN_PARAM_SWTEST,
#endif
0);
@@ -163,32 +160,23 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
}
else
{
-/* Der Drucker wird jetzt von der TabPage erzeugt und auch geloescht
- * SfxItemSet* pSet = new SfxItemSet( SFX_APP()->GetPool(),
- SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
- SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
- 0 );
-
- pPrt = new SfxPrinter(pSet);
- pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
-
SvtLinguConfig aLinguCfg;
Locale aLocale;
LanguageType nLang;
using namespace ::com::sun::star::i18n::ScriptType;
- Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
+ Any aLang = aLinguCfg.GetProperty(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale")));
aLang >>= aLocale;
nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
- aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
+ aLang = aLinguCfg.GetProperty(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CJK")));
aLang >>= aLocale;
nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
- aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
+ aLang = aLinguCfg.GetProperty(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CTL")));
aLang >>= aLocale;
nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
@@ -211,6 +199,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
pAppView->GetVLinealMetric(eUnit);
pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
+ pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
if(bTextDialog)
{
if(pAppView)
@@ -224,10 +213,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)pPref->GetDefTab()));
}
- /*-----------------01.02.97 11.13-------------------
- Optionen fuer GridTabPage
- --------------------------------------------------*/
-
+ // Options for GridTabPage
SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
@@ -243,9 +229,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
pRet->Put(aGridItem);
- /*-----------------01.02.97 13.02-------------------
- Optionen fuer PrintTabPage
- --------------------------------------------------*/
+ // Options for PrintTabPage
const SwPrintData* pOpt = pAppView ?
&pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
0;
@@ -256,42 +240,17 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
pRet->Put(aAddPrinterItem);
- /*-----------------01.02.97 13.12-------------------
- Optionen fuer Web-Hintergrund
- --------------------------------------------------*/
+ // Options for Web background
if(!bTextDialog)
{
pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
}
-#ifdef DBG_UTIL
- /*-----------------01.02.97 13.02-------------------
- Test-Optionen
- --------------------------------------------------*/
- SwTestItem aTestItem(FN_PARAM_SWTEST);
- aTestItem.bTest1 = aViewOpt.IsTest1();
- aTestItem.bTest2 = aViewOpt.IsTest2();
- aTestItem.bTest3 = aViewOpt.IsTest3();
- aTestItem.bTest4 = aViewOpt.IsTest4();
- aTestItem.bTest5 = aViewOpt.IsTest5();
- aTestItem.bTest6 = aViewOpt.IsTest6();
- aTestItem.bTest7 = aViewOpt.IsTest7();
- aTestItem.bTest8 = aViewOpt.IsTest8();
- aTestItem.bTest9 = SwViewOption::IsTest9();
- aTestItem.bTest10 = aViewOpt.IsTest10();
- pRet->Put(aTestItem);
-#endif
- /*-----------------01.02.97 13.04-------------------
-
- --------------------------------------------------*/
if(!bTextDialog)
pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
-// delete pPrt;
return pRet;
}
-/* -----------------12.02.99 12:28-------------------
- *
- * --------------------------------------------------*/
+
void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
{
sal_Bool bTextDialog = nId == SID_SW_EDITOPTIONS;
@@ -303,7 +262,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
// the text dialog mustn't apply data to the web view and vice versa
sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
if( (bWebView == bTextDialog))
- pAppView = 0; //
+ pAppView = 0;
}
SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
@@ -314,7 +273,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
: NULL;
/*---------------------------------------------------------------------
- Seite Dokumentansicht auswerten
+ Interpret the page Documentview
-----------------------------------------------------------------------*/
if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, &pItem ))
{
@@ -342,7 +301,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
}
/*---------------------------------------------------------------------
- Elemente - Item auswerten
+ Elements - interpret Item
-----------------------------------------------------------------------*/
if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, sal_False, &pItem ) )
@@ -358,6 +317,14 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
}
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT,
+ sal_False, &pItem ) )
+ {
+ SFX_APP()->SetOptions(rSet);
+ const SfxBoolItem* pCharItem = (const SfxBoolItem*)pItem;
+ ::SetApplyCharUnit(pCharItem->GetValue(), !bTextDialog);
+ }
+
if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, sal_False, &pItem ) )
{
const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
@@ -389,8 +356,8 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
}
- /*-----------------01.02.97 11.36-------------------
- Hintergrund nur im WebDialog
+ /*------------------------------------------------
+ Background only in WebDialog
--------------------------------------------------*/
if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
{
@@ -400,7 +367,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
}
/*--------------------------------------------------------------------
- Seite Rastereinstellungen auswerten
+ Interpret page Grid Settings
----------------------------------------------------------------------*/
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, sal_False, &pItem ))
@@ -429,9 +396,9 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
}
}
- //--------------------------------------------------------------------------
- // Writer Drucker Zusatzeinstellungen auswerten
- //----------------------------------------------------------------------------
+ /*--------------------------------------------------------------------
+ Interpret Writer Printer Options
+ ----------------------------------------------------------------------*/
if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, sal_False, &pItem ))
{
@@ -471,33 +438,10 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
}
-#ifdef DBG_UTIL
- /*--------------------------------------------------------------------------
- Writer Testseite auswerten
- ----------------------------------------------------------------------------*/
-
- if( SFX_ITEM_SET == rSet.GetItemState(
- FN_PARAM_SWTEST, sal_False, &pItem ))
- {
- const SwTestItem* pTestItem = (const SwTestItem*)pItem;
- aViewOpt.SetTest1((sal_Bool)pTestItem->bTest1);
- aViewOpt.SetTest2((sal_Bool)pTestItem->bTest2);
- aViewOpt.SetTest3((sal_Bool)pTestItem->bTest3);
- aViewOpt.SetTest4((sal_Bool)pTestItem->bTest4);
- aViewOpt.SetTest5((sal_Bool)pTestItem->bTest5);
- aViewOpt.SetTest6((sal_Bool)pTestItem->bTest6);
- aViewOpt.SetTest7((sal_Bool)pTestItem->bTest7);
- aViewOpt.SetTest8((sal_Bool)pTestItem->bTest8);
- SwViewOption::SetTest9((sal_Bool)pTestItem->bTest9);
- aViewOpt.SetTest10((sal_Bool)pTestItem->bTest10);
- }
-#endif
- // dann an der akt. View und Shell die entsp. Elemente setzen
+ // set elements for the current view and shell
ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
}
-/* -----------------12.02.99 12:28-------------------
- *
- * --------------------------------------------------*/
+
SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
{
SfxTabPage* pRet = NULL;
@@ -566,7 +510,7 @@ SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxI
SwView* pCurrView = GetView();
if(pCurrView)
{
- // wenn Text dann nicht WebView und umgekehrt
+ // if text then not WebView and vice versa
sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
(!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
@@ -602,7 +546,7 @@ SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxI
}
}
break;
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 1
case RID_SW_TP_OPTTEST_PAGE:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
@@ -640,7 +584,9 @@ SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxI
break;
}
- DBG_ASSERT( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
+ OSL_ENSURE( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
return pRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */