diff options
author | obo <obo@openoffice.org> | 2010-06-09 16:35:27 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-09 16:35:27 +0200 |
commit | 0a11354fc949dff5860a0b4240f18c6320561f9b (patch) | |
tree | caffe5954a41a3821057710d64e5995d773c8856 | |
parent | 5059f173f05fa57e8f7009dd9c082c8e85a6cc5f (diff) | |
parent | 87c6b7fab33c03c6cab6d4365125f1acf9929811 (diff) |
CWS-TOOLING: integrate CWS tl74
56 files changed, 1568 insertions, 3206 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index b019a5b08ee1..75aee6fd2009 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -300,7 +300,7 @@ public: class SmShowSymbolSet : public Control { - SmSymSet aSymbolSet; + SymbolPtrVec_t aSymbolSet; ScrollBar aVScrollBar; Size aOutputSize; Link aSelectHdlLink; @@ -318,7 +318,7 @@ class SmShowSymbolSet : public Control public: SmShowSymbolSet(Window *pParent, const ResId& rResId); - void SetSymbolSet(const SmSymSet& rSymbolSet); + void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet); void SelectSymbol(USHORT nSymbol); USHORT GetSelectSymbol() const { return nSelectSymbol; } @@ -360,8 +360,10 @@ class SmSymbolDialog : public ModalDialog PushButton aEditBtn; SmViewShell &rViewSh; - SmSymSetManager &rSymSetMgr; - const SmSymSet *pSymSet; + SmSymbolManager &rSymbolMgr; + + String aSymbolSetName; + SymbolPtrVec_t aSymbolSet; OutputDevice *pFontListDev; @@ -373,7 +375,7 @@ class SmSymbolDialog : public ModalDialog DECL_LINK(GetClickHdl, Button *); void FillSymbolSets(BOOL bDeleteText = TRUE); - void SetSymbolSetManager(SmSymSetManager &rMgr); + void SetSymbolSetManager(SmSymbolManager &rMgr); const SmSym *GetSymbol() const; void InitColor_Impl(); @@ -381,7 +383,7 @@ class SmSymbolDialog : public ModalDialog public: SmSymbolDialog(Window * pParent, OutputDevice *pFntListDevice, - SmSymSetManager &rSymSetMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE); + SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE); virtual ~SmSymbolDialog(); BOOL SelectSymbolSet(const XubString &rSymbolSetName); @@ -439,8 +441,8 @@ class SmSymDefineDialog : public ModalDialog Image aRigthArrow_Im; Image aRigthArrow_Im_HC; // hi-contrast version - SmSymSetManager aSymSetMgrCopy, - &rSymSetMgr; + SmSymbolManager aSymbolMgrCopy, + &rSymbolMgr; const SmSym *pOrigSymbol; const SubsetMap *pSubsetMap; @@ -462,7 +464,7 @@ class SmSymDefineDialog : public ModalDialog void FillFonts(BOOL bDeleteText = TRUE); void FillStyles(BOOL bDeleteText = TRUE); - void SetSymbolSetManager(const SmSymSetManager &rMgr); + void SetSymbolSetManager(const SmSymbolManager &rMgr); void SetFont(const XubString &rFontName, const XubString &rStyleName); void SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName); void UpdateButtons(); @@ -474,18 +476,18 @@ class SmSymDefineDialog : public ModalDialog BOOL SelectFont(const XubString &rFontName, BOOL bApplyFont); BOOL SelectStyle(const XubString &rStyleName, BOOL bApplyFont); - - SmSymSet *GetSymbolSet(const ComboBox &rComboBox); - inline const SmSymSet *GetSymbolSet(const ComboBox &rComboBox) const; - SmSym *GetSymbol(const ComboBox &rComboBox); - inline const SmSym *GetSymbol(const ComboBox &rComboBox) const; + SmSym * GetSymbol(const ComboBox &rComboBox); + const SmSym * GetSymbol(const ComboBox &rComboBox) const + { + return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox); + } void InitColor_Impl(); virtual void DataChanged( const DataChangedEvent& rDCEvt ); public: - SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymSetManager &rMgr, BOOL bFreeRes = TRUE); + SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr, BOOL bFreeRes = TRUE); ~SmSymDefineDialog(); using OutputDevice::SetFont; @@ -493,44 +495,31 @@ public: // Dialog virtual short Execute(); - inline BOOL SelectOldSymbolSet(const XubString &rSymbolSetName); - inline BOOL SelectOldSymbol(const XubString &rSymbolName); - inline BOOL SelectSymbolSet(const XubString &rSymbolSetName); - inline BOOL SelectSymbol(const XubString &rSymbolName); - BOOL SelectFont(const XubString &rFontName) { return SelectFont(rFontName, TRUE); } - BOOL SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); }; - void SelectChar(xub_Unicode cChar); -}; - -inline const SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox) const -{ - return ((SmSymDefineDialog *) this)->GetSymbolSet(rComboBox); -} + BOOL SelectOldSymbolSet(const XubString &rSymbolSetName) + { + return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE); + } -inline const SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) const -{ - return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox); -} + BOOL SelectOldSymbol(const XubString &rSymbolName) + { + return SelectSymbol(aOldSymbols, rSymbolName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectOldSymbolSet(const XubString &rSymbolSetName) -{ - return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE); -} + BOOL SelectSymbolSet(const XubString &rSymbolSetName) + { + return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectOldSymbol(const XubString &rSymbolName) -{ - return SelectSymbol(aOldSymbols, rSymbolName, FALSE); -} + BOOL SelectSymbol(const XubString &rSymbolName) + { + return SelectSymbol(aSymbols, rSymbolName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectSymbolSet(const XubString &rSymbolSetName) -{ - return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE); -} + BOOL SelectFont(const XubString &rFontName) { return SelectFont(rFontName, TRUE); } + BOOL SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); }; + void SelectChar(xub_Unicode cChar); +}; -inline BOOL SmSymDefineDialog::SelectSymbol(const XubString &rSymbolName) -{ - return SelectSymbol(aSymbols, rSymbolName, FALSE); -} #endif diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index bd8292e9a7b1..f74beb9de92b 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -47,7 +47,7 @@ class SvxErrorHandler; class SfxObjectFactory; class SmConfig; class SmModule; -class SmSymSetManager; +class SmSymbolManager; /************************************************************************* |* @@ -149,7 +149,7 @@ public: svtools::ColorConfig & GetColorConfig(); SmConfig * GetConfig(); - SmSymSetManager & GetSymSetManager(); + SmSymbolManager & GetSymbolManager(); SmLocalizedSymbolData & GetLocSymbolData() const; @@ -176,7 +176,6 @@ public: }; #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) ) -#define SM_MOD1() ( *(SmModule**) GetAppData(SHL_SM) ) #endif // _SDMOD_HXX diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 8c8df60c2c6e..503859485095 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -28,198 +28,146 @@ #define SYMBOL_HXX #include <vos/refernce.hxx> -#ifndef _FONT_HXX //autogen #include <vcl/font.hxx> -#endif #include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/dynary.hxx> #include <svl/lstner.hxx> #include <svl/svarray.hxx> + +#include <map> +#include <vector> +#include <set> + #include "utility.hxx" -#include <smmod.hxx> +#include "smmod.hxx" -#define SS_ATTR_ACCESS 0x80 #define SYMBOLSET_NONE 0xFFFF #define SYMBOL_NONE 0xFFFF -class SmSymSetManager; //////////////////////////////////////////////////////////////////////////////// inline const String GetExportSymbolName( const String &rUiSymbolName ) { - return SM_MOD1()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); + return SM_MOD()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); } inline const String GetUiSymbolName( const String &rExportSymbolName ) { - return SM_MOD1()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); + return SM_MOD()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); } inline const String GetExportSymbolSetName( const String &rUiSymbolSetName ) { - return SM_MOD1()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); + return SM_MOD()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); } inline const String GetUiSymbolSetName( const String &rExportSymbolSetName ) { - return SM_MOD1()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); + return SM_MOD()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); } //////////////////////////////////////////////////////////////////////////////// class SmSym { - friend class SmSymSetManager; - - SmFace Face; - String Name; - String aExportName; - String aSetName; - SmSym *pHashNext; - SmSymSetManager *pSymSetManager; - sal_Unicode Character; - BYTE Attribut; - BOOL bPredefined; - BOOL bDocSymbol; + SmFace m_aFace; + String m_aName; + String m_aExportName; + String m_aSetName; + sal_Unicode m_cChar; + BOOL m_bPredefined; + BOOL m_bDocSymbol; public: SmSym(); - SmSym(const SmSym& rSymbol); SmSym(const String& rName, const Font& rFont, sal_Unicode cChar, const String& rSet, BOOL bIsPredefined = FALSE); + SmSym(const SmSym& rSymbol); SmSym& operator = (const SmSym& rSymbol); - const Font& GetFace() const { return Face; } - sal_Unicode GetCharacter() const { return Character; } - const String& GetName() const { return Name; } + const Font& GetFace() const { return m_aFace; } + sal_Unicode GetCharacter() const { return m_cChar; } + const String& GetName() const { return m_aName; } - void SetFace( const Font& rFont ) { Face = rFont; } - void SetCharacter( sal_Unicode cChar ) { Character = cChar; } - void SetName( const String &rTxt ) { Name = rTxt; } + void SetFace( const Font& rFont ) { m_aFace = rFont; } + void SetCharacter( sal_Unicode cChar ) { m_cChar = cChar; } - BOOL IsPredefined() const { return bPredefined; } - const String & GetSetName() const { return aSetName; } - void SetSetName( const String &rName ) { aSetName = rName; } - const String & GetExportName() const { return aExportName; } - void SetExportName( const String &rName ) { aExportName = rName; } +//! since the symbol name is also used as key in the map it should not be possible to change the name +//! because ten the key would not be the same as its supposed copy here +// void SetName( const String &rTxt ) { m_aName = rTxt; } - BOOL IsDocSymbol() const { return bDocSymbol; } - void SetDocSymbol( BOOL bVal ) { bDocSymbol = bVal; } -}; + BOOL IsPredefined() const { return m_bPredefined; } + const String & GetSymbolSetName() const { return m_aSetName; } + void SetSymbolSetName( const String &rName ) { m_aSetName = rName; } + const String & GetExportName() const { return m_aExportName; } + void SetExportName( const String &rName ) { m_aExportName = rName; } + + BOOL IsDocSymbol() const { return m_bDocSymbol; } + void SetDocSymbol( BOOL bVal ) { m_bDocSymbol = bVal; } -DECLARE_LIST(SmListSym, SmSym *) -SV_DECL_PTRARR( SymbolArray, SmSym *, 32, 32 ) + // true if rSymbol has the same name, font and character + bool IsEqualInUI( const SmSym& rSymbol ) const; +}; /**************************************************************************/ -class SmSymSet +struct lt_String { - friend class SmSymSetManager; - - SmListSym SymbolList; - String Name; - SmSymSetManager *pSymSetManager; - -public: - SmSymSet(); - SmSymSet(const SmSymSet& rSymbolSet); - SmSymSet(const String& rName); - ~SmSymSet(); - - SmSymSet& operator = (const SmSymSet& rSymbolSet); - - const String& GetName() const { return Name; } - USHORT GetCount() const { return (USHORT) SymbolList.Count(); } - - const SmSym& GetSymbol(USHORT SymbolNo) const + bool operator()( const String &r1, const String &r2 ) const { - DBG_ASSERT(SymbolList.GetObject(SymbolNo), "Symbol nicht vorhanden"); - return *SymbolList.GetObject(SymbolNo); + // r1 < r2 ? + return r1.CompareTo( r2 ) == COMPARE_LESS; } - - USHORT AddSymbol(SmSym* pSymbol); - void DeleteSymbol(USHORT SymbolNo); - SmSym * RemoveSymbol(USHORT SymbolNo); - USHORT GetSymbolPos(const String& rName); }; -DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *) - -/**************************************************************************/ - -class SmSymbolDialog; - - -struct SmSymSetManager_Impl -{ - SmArraySymSet SymbolSets; - SmSymSetManager & rSymSetMgr; - SmSym** HashEntries; - USHORT NoSymbolSets; - USHORT NoHashEntries; - BOOL Modified; - - SmSymSetManager_Impl( SmSymSetManager &rMgr, USHORT HashTableSize ); - ~SmSymSetManager_Impl(); - SmSymSetManager_Impl & operator = ( const SmSymSetManager_Impl &rImpl ); -}; +// type of the actual container to hold the symbols +typedef std::map< String, SmSym, lt_String > SymbolMap_t; +// vector of pointers to the actual symbols in the above container +typedef std::vector< const SmSym * > SymbolPtrVec_t; -class SmSymSetManager : public SfxListener +class SmSymbolManager : public SfxListener { - friend struct SmSymSetManager_Impl; - - SmSymSetManager_Impl *pImpl; + SymbolMap_t m_aSymbols; + bool m_bModified; virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType); - UINT32 GetHashIndex(const String& rSymbolName); - void EnterHashTable(SmSym& rSymbol); - void EnterHashTable(SmSymSet& rSymbolSet); - void FillHashTable(); void Init(); void Exit(); public: - SmSymSetManager(USHORT HashTableSize = 137); - SmSymSetManager(const SmSymSetManager& rSymbolSetManager); - ~SmSymSetManager(); + SmSymbolManager(); + SmSymbolManager(const SmSymbolManager& rSymbolSetManager); + ~SmSymbolManager(); - SmSymSetManager& operator = (const SmSymSetManager& rSymbolSetManager); + SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager); - void GetSymbols( std::vector< SmSym > &rSymbols ) const; + // symbol sets are for UI purpose only, thus we assemble them here + std::set< String > GetSymbolSetNames() const; + const SymbolPtrVec_t GetSymbolSet( const String& rSymbolSetName ); - - USHORT AddSymbolSet(SmSymSet* pSymbolSet); - void ChangeSymbolSet(SmSymSet* pSymbolSet); - void DeleteSymbolSet(USHORT SymbolSetNo); - USHORT GetSymbolSetPos(const String& rSymbolSetName) const; - USHORT GetSymbolSetCount() const { return pImpl->NoSymbolSets; } - SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const - { - return pImpl->SymbolSets.Get(SymbolSetNo); - } + USHORT GetSymbolCount() const { return static_cast< USHORT >(m_aSymbols.size()); } + const SymbolPtrVec_t GetSymbols() const; + bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false ); + void RemoveSymbol( const String & rSymbolName ); SmSym * GetSymbolByName(const String& rSymbolName); const SmSym * GetSymbolByName(const String& rSymbolName) const { - return ((SmSymSetManager *) this)->GetSymbolByName(rSymbolName); + return ((SmSymbolManager *) this)->GetSymbolByName(rSymbolName); } - void AddReplaceSymbol( const SmSym & rSymbol ); - USHORT GetSymbolCount() const; - const SmSym * GetSymbolByPos( USHORT nPos ) const; - - BOOL IsModified() const { return pImpl->Modified; } - void SetModified(BOOL Modify) { pImpl->Modified = Modify; } + bool IsModified() const { return m_bModified; } + void SetModified(bool bModify) { m_bModified = bModify; } void Load(); void Save(); diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index da507871ed61..bf62157a30d3 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -429,7 +429,7 @@ SmMathConfig::SmMathConfig() : pFormat = 0; pOther = 0; pFontFormatList = 0; - pSymSetMgr = 0; + pSymbolMgr = 0; bIsOtherModified = bIsFormatModified = FALSE; } @@ -441,7 +441,7 @@ SmMathConfig::~SmMathConfig() delete pFormat; delete pOther; delete pFontFormatList; - delete pSymSetMgr; + delete pSymbolMgr; } @@ -554,14 +554,14 @@ void SmMathConfig::ReadSymbol( SmSym &rSymbol, } -SmSymSetManager & SmMathConfig::GetSymSetManager() +SmSymbolManager & SmMathConfig::GetSymbolManager() { - if (!pSymSetMgr) + if (!pSymbolMgr) { - pSymSetMgr = new SmSymSetManager; - pSymSetMgr->Load(); + pSymbolMgr = new SmSymbolManager; + pSymbolMgr->Load(); } - return *pSymSetMgr; + return *pSymbolMgr; } @@ -570,6 +570,7 @@ void SmMathConfig::Commit() Save(); } + void SmMathConfig::Save() { SaveOther(); @@ -577,6 +578,7 @@ void SmMathConfig::Save() SaveFontFormatList(); } + void SmMathConfig::GetSymbols( std::vector< SmSym > &rSymbols ) const { Sequence< OUString > aNodes( ((SmMathConfig*) this)->GetNodeNames( A2OU( SYMBOL_LIST ) ) ); @@ -627,7 +629,7 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols ) // Set pVal->Name = aNodeNameDelim; pVal->Name += *pName++; - OUString aTmp( rSymbol.GetSetName() ); + OUString aTmp( rSymbol.GetSymbolSetName() ); if (rSymbol.IsPredefined()) aTmp = GetExportSymbolSetName( aTmp ); pVal->Value <<= aTmp; diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx index 514573f6e7ac..9e4aa9f39f2f 100644 --- a/starmath/source/cfgitem.hxx +++ b/starmath/source/cfgitem.hxx @@ -122,7 +122,7 @@ class SmMathConfig : public utl::ConfigItem SmFormat * pFormat; SmCfgOther * pOther; SmFontFormatList * pFontFormatList; - SmSymSetManager * pSymSetMgr; + SmSymbolManager * pSymbolMgr; BOOL bIsOtherModified; BOOL bIsFormatModified; @@ -182,7 +182,7 @@ public: //using utl::ConfigItem::ReplaceSetProperties; //using utl::ConfigItem::GetReadOnlyStates; - SmSymSetManager & GetSymSetManager(); + SmSymbolManager & GetSymbolManager(); void GetSymbols( std::vector< SmSym > &rSymbols ) const; void SetSymbols( const std::vector< SmSym > &rNewSymbols ); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 257fdb959484..453e265cb46b 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -426,7 +426,7 @@ IMPL_LINK( SmFontSizeDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -533,7 +533,7 @@ IMPL_LINK_INLINE_START( SmFontTypeDialog, DefaultButtonClickHdl, Button *, EMPTY QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY)); if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt, TRUE ); @@ -579,7 +579,7 @@ SmFontTypeDialog::SmFontTypeDialog(Window * pParent, OutputDevice *pFntListDevic void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); aVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE); aFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION); @@ -601,7 +601,7 @@ void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat) void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = aVariableFont; pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = aFunctionFont; @@ -740,7 +740,7 @@ IMPL_LINK( SmDistanceDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -1063,7 +1063,7 @@ IMPL_LINK( SmAlignDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton*/ if (pQueryBox->Execute() == RET_YES) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -1140,12 +1140,12 @@ void SmShowSymbolSet::Paint(const Rectangle&) SetMapMode(MapMode(MAP_PIXEL)); USHORT v = sal::static_int_cast< USHORT >((aVScrollBar.GetThumbPos() * nColumns)); - USHORT nSymbols = aSymbolSet.GetCount(); + size_t nSymbols = aSymbolSet.size(); Color aTxtColor( GetTextColor() ); for (USHORT i = v; i < nSymbols ; i++) { - SmSym aSymbol (aSymbolSet.GetSymbol(i)); + SmSym aSymbol (*aSymbolSet[i]); Font aFont (aSymbol.GetFace()); aFont.SetAlign(ALIGN_TOP); @@ -1206,7 +1206,7 @@ void SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt) case KEY_LEFT: n -= 1; break; case KEY_RIGHT: n += 1; break; case KEY_HOME: n = 0; break; - case KEY_END: n = aSymbolSet.GetCount() - 1; break; + case KEY_END: n = static_cast< USHORT >(aSymbolSet.size() - 1); break; case KEY_PAGEUP: n -= nColumns * nRows; break; case KEY_PAGEDOWN: n += nColumns * nRows; break; @@ -1218,7 +1218,7 @@ void SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt) else n = 0; - if (n >= aSymbolSet.GetCount()) + if (n >= aSymbolSet.size()) n = nSelectSymbol; // adjust scrollbar @@ -1274,13 +1274,13 @@ SmShowSymbolSet::SmShowSymbolSet(Window *pParent, const ResId& rResId) : } -void SmShowSymbolSet::SetSymbolSet(const SmSymSet& rSymbolSet) +void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolSet = rSymbolSet; - if (aSymbolSet.GetCount() > (nColumns * nRows)) + if (static_cast< USHORT >(aSymbolSet.size()) > (nColumns * nRows)) { - aVScrollBar.SetRange(Range(0, ((aSymbolSet.GetCount() + (nColumns - 1)) / nColumns) - nRows)); + aVScrollBar.SetRange(Range(0, ((aSymbolSet.size() + (nColumns - 1)) / nColumns) - nRows)); aVScrollBar.Enable(TRUE); } else @@ -1302,10 +1302,10 @@ void SmShowSymbolSet::SelectSymbol(USHORT nSymbol) ((nSelectSymbol - v) / nColumns) * nLen), Size(nLen, nLen))); - if (nSymbol < aSymbolSet.GetCount()) + if (nSymbol < aSymbolSet.size()) nSelectSymbol = nSymbol; - if (aSymbolSet.GetCount() == 0) + if (aSymbolSet.size() == 0) nSelectSymbol = SYMBOL_NONE; if (nSelectSymbol != SYMBOL_NONE) @@ -1380,9 +1380,10 @@ void SmSymbolDialog::FillSymbolSets(BOOL bDeleteText) if (bDeleteText) aSymbolSets.SetNoSelection(); - USHORT nNumSymSets = rSymSetMgr.GetSymbolSetCount(); - for (USHORT i = 0; i < nNumSymSets; i++) - aSymbolSets.InsertEntry(rSymSetMgr.GetSymbolSet(i)->GetName()); + std::set< String > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() ); + std::set< String >::const_iterator aIt( aSybolSetNames.begin() ); + for ( ; aIt != aSybolSetNames.end(); ++aIt) + aSymbolSets.InsertEntry( *aIt ); } @@ -1416,7 +1417,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) DBG_ASSERT(pButton == &aEditBtn, "Sm : falsches Argument"); #endif - SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymSetMgr); + SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr); // aktuelles Symbol und SymbolSet am neuen Dialog setzen const XubString aSymSetName (aSymbolSets.GetSelectEntry()), @@ -1432,9 +1433,9 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) USHORT nSymPos = GetSelectedSymbol(); // Dialog an evtl geaenderte Daten des SymbolSet Manager anpassen - if (pDialog->Execute() == RET_OK && rSymSetMgr.IsModified()) + if (pDialog->Execute() == RET_OK && rSymbolMgr.IsModified()) { - rSymSetMgr.Save(); + rSymbolMgr.Save(); FillSymbolSets(); } @@ -1442,7 +1443,16 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) // (soweit eines vorhanden ist) if (!SelectSymbolSet(aOldSymbolSet) && aSymbolSets.GetEntryCount() > 0) SelectSymbolSet(aSymbolSets.GetEntry(0)); + else + { + // just update display of current symbol set + DBG_ASSERT( aSymSetName == aSymSetName, "unexpected change in symbol set name" ); + aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName ); + aSymbolSetDisplay.SetSymbolSet( aSymbolSet ); + } + if (nSymPos >= aSymbolSet.size()) + nSymPos = static_cast< USHORT >(aSymbolSet.size()) - 1; SelectSymbol( nSymPos ); delete pDialog; @@ -1499,7 +1509,7 @@ IMPL_LINK_INLINE_END( SmSymbolDialog, CloseClickHdl, Button *, pButton ) SmSymbolDialog::SmSymbolDialog(Window *pParent, OutputDevice *pFntListDevice, - SmSymSetManager &rMgr, SmViewShell &rViewShell, BOOL bFreeRes) : + SmSymbolManager &rMgr, SmViewShell &rViewShell, BOOL bFreeRes) : ModalDialog (pParent, SmResId(RID_SYMBOLDIALOG)), aSymbolSetText (this, SmResId(1)), aSymbolSets (this, SmResId(1)), @@ -1510,13 +1520,14 @@ SmSymbolDialog::SmSymbolDialog(Window *pParent, OutputDevice *pFntListDevice, aCloseBtn (this, SmResId(3)), aEditBtn (this, SmResId(1)), rViewSh (rViewShell), - rSymSetMgr (rMgr), + rSymbolMgr (rMgr), pFontListDev (pFntListDevice) { if (bFreeRes) FreeResource(); - pSymSet = NULL; + aSymbolSetName = String(); + aSymbolSet.clear(); FillSymbolSets(); if (aSymbolSets.GetEntryCount() > 0) SelectSymbolSet(aSymbolSets.GetEntry(0)); @@ -1580,18 +1591,17 @@ BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName) BOOL bRet = FALSE; USHORT nPos = aSymbolSets.GetEntryPos(rSymbolSetName); - pSymSet = NULL; + aSymbolSetName = String(); + aSymbolSet.clear(); if (nPos != LISTBOX_ENTRY_NOTFOUND) { aSymbolSets.SelectEntryPos(nPos); - USHORT nSymbolSetNo = rSymSetMgr.GetSymbolSetPos(aSymbolSets.GetSelectEntry()); - pSymSet = rSymSetMgr.GetSymbolSet(nSymbolSetNo); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pSymSet, "Sm : NULL pointer"); -#endif - aSymbolSetDisplay.SetSymbolSet(*pSymSet); - if (pSymSet->GetCount() > 0) + aSymbolSetName = rSymbolSetName; + aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName ); + + aSymbolSetDisplay.SetSymbolSet( aSymbolSet ); + if (aSymbolSet.size() > 0) SelectSymbol(0); bRet = TRUE; @@ -1606,8 +1616,8 @@ BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName) void SmSymbolDialog::SelectSymbol(USHORT nSymbolNo) { const SmSym *pSym = NULL; - if (pSymSet && nSymbolNo < pSymSet->GetCount()) - pSym = &pSymSet->GetSymbol(nSymbolNo); + if (aSymbolSetName.Len() > 0 && nSymbolNo < static_cast< USHORT >(aSymbolSet.size())) + pSym = aSymbolSet[ nSymbolNo ]; aSymbolSetDisplay.SelectSymbol(nSymbolNo); aSymbolDisplay.SetSymbol(pSym); @@ -1618,7 +1628,8 @@ void SmSymbolDialog::SelectSymbol(USHORT nSymbolNo) const SmSym * SmSymbolDialog::GetSymbol() const { USHORT nSymbolNo = aSymbolSetDisplay.GetSelectSymbol(); - return pSymSet == NULL ? NULL : &pSymSet->GetSymbol(nSymbolNo); + bool bValid = aSymbolSetName.Len() > 0 && nSymbolNo < static_cast< USHORT >(aSymbolSet.size()); + return bValid ? aSymbolSet[ nSymbolNo ] : NULL; } @@ -1678,15 +1689,10 @@ void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, BOOL bDeleteText) if (bDeleteText) rComboBox.SetText(XubString()); - ComboBox &rSymbolSets = &rComboBox == &aOldSymbols ? - aOldSymbolSets : aSymbolSets; - const SmSymSet *pSymSet = GetSymbolSet(rSymbolSets); - if (pSymSet) - { USHORT nNumSymbols = pSymSet->GetCount(); - for (USHORT i = 0; i < nNumSymbols; i++) - rComboBox.InsertEntry(pSymSet->GetSymbol(i).GetName()); - } - + ComboBox &rBox = &rComboBox == &aOldSymbols ? aOldSymbolSets : aSymbolSets; + SymbolPtrVec_t aSymSet( aSymbolMgrCopy.GetSymbolSet( rBox.GetText() ) ); + for (size_t i = 0; i < aSymSet.size(); ++i) + rComboBox.InsertEntry( aSymSet[i]->GetName() ); } @@ -1701,9 +1707,10 @@ void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, BOOL bDeleteText) if (bDeleteText) rComboBox.SetText(XubString()); - USHORT nNumSymSets = aSymSetMgrCopy.GetSymbolSetCount(); - for (USHORT i = 0; i < nNumSymSets; i++) - rComboBox.InsertEntry(aSymSetMgrCopy.GetSymbolSet(i)->GetName()); + const std::set< String > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() ); + std::set< String >::const_iterator aIt( aSymbolSetNames.begin() ); + for ( ; aIt != aSymbolSetNames.end(); ++aIt) + rComboBox.InsertEntry( *aIt ); } @@ -1748,26 +1755,13 @@ void SmSymDefineDialog::FillStyles(BOOL bDeleteText) } -SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox) -{ -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, - "Sm : falsche ComboBox"); -#endif - USHORT nSymbolSetNo = aSymSetMgrCopy.GetSymbolSetPos(rComboBox.GetText()); - - return nSymbolSetNo == SYMBOLSET_NONE ? - NULL : aSymSetMgrCopy.GetSymbolSet(nSymbolSetNo); -} - - SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) { #if OSL_DEBUG_LEVEL > 1 DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, "Sm : falsche ComboBox"); #endif - return aSymSetMgrCopy.GetSymbolByName(rComboBox.GetText()); + return aSymbolMgrCopy.GetSymbolByName(rComboBox.GetText()); } @@ -1897,32 +1891,23 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, EMPTYARG pButton ) DBG_ASSERT(aAddBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); #endif - SmSymSet *pSymSet = GetSymbolSet(aSymbolSets); - - // SymbolSet einfuegen falls es noch nicht existiert - if (!pSymSet) - { - pSymSet = new SmSymSet(aSymbolSets.GetText()); - aSymSetMgrCopy.AddSymbolSet(pSymSet); - FillSymbolSets(aOldSymbolSets, FALSE); - FillSymbolSets(aSymbolSets, FALSE); - } -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pSymSet, "Sm : NULL pointer"); -#endif - - // Symbol ins SymbolSet einfuegen + // add symbol // TO_DO_UCS4 (#i74049): get rid of cast without loosing UCS4 functionality - SmSym *pSym = new SmSym(aSymbols.GetText(), aCharsetDisplay.GetFont(), - sal::static_int_cast< sal_Unicode >(aCharsetDisplay.GetSelectCharacter()), - aSymbolSets.GetText()); - pSymSet->AddSymbol(pSym); - - // update der Hash Tabelle erzwingen (damit aAddBtn disabled wird). - // (wird spaeter nach Ueberarbeitung von symbol.cxx ueberfluessig werden). - aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1); - - // Symbolliste aktualiseren + const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), + sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), + aSymbolSets.GetText() ); + DBG_ASSERT( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" ); + aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol ); + + // update display of new symbol + aSymbolDisplay.SetChar( aNewSymbol.GetCharacter() ); + aSymbolDisplay.SetFont( aNewSymbol.GetFace() ); + aSymbolName.SetText( aNewSymbol.GetName() ); + aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() ); + + // update list box entries + FillSymbolSets(aOldSymbolSets, FALSE); + FillSymbolSets(aSymbolSets, FALSE); FillSymbols(aOldSymbols ,FALSE); FillSymbols(aSymbols ,FALSE); @@ -1940,61 +1925,36 @@ IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, EMPTYARG pButton ) DBG_ASSERT(aChangeBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); #endif - // finden des SymbolSets zum alten Symbol - SmSymSet *pOldSymSet = GetSymbolSet(aOldSymbolSets); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pOldSymSet, "Sm : NULL pointer"); -#endif - - // suchen des neuen SymbolSets - SmSymSet *pNewSymSet = GetSymbolSet(aSymbolSets); - // SymbolSet einfuegen falls es noch nicht existiert - if (!pNewSymSet) - { - pNewSymSet = new SmSymSet(aSymbolSets.GetText()); - aSymSetMgrCopy.AddSymbolSet(pNewSymSet); - FillSymbolSets(aOldSymbolSets, FALSE); - FillSymbolSets(aSymbolSets, FALSE); - } - - // das (alte) Symbol besorgen - USHORT nSymbol = pOldSymSet->GetSymbolPos(aOldSymbols.GetText()); - SmSym *pSym = (SmSym *) &pOldSymSet->GetSymbol(nSymbol); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( SYMBOL_NONE != nSymbol, "symbol not found" ); - DBG_ASSERT(pSym, "Sm : NULL pointer"); -#endif - - // apply changes - pSym->SetName( aSymbols.GetText() ); - //! get font from symbol-display since charset-display does not keep + // get new Sybol to use + //! get font from symbol-disp lay since charset-display does not keep //! the bold attribut. - pSym->SetFace( aSymbolDisplay.GetFont() ); // TO_DO_UCS4 (#i74049): get rid of cast without loosing UCS4 functionality - pSym->SetCharacter( sal::static_int_cast< sal_Unicode >(aCharsetDisplay.GetSelectCharacter()) ); - - // das SymbolSet wechseln wenn noetig - if (pOldSymSet != pNewSymSet) - { - pNewSymSet->AddSymbol( new SmSym( *pSym ) ); - pOldSymSet->DeleteSymbol(nSymbol); - - // - // update controls - // - // actualize symbol-lists in the dialog - String aTmpOldSymbolName( pOrigSymbol->GetName() ); - aOldSymbols.SetText( String() ); - aOldSymbols.RemoveEntry( aTmpOldSymbolName ); - if (aSymbolSets.GetText() == aOldSymbolSets.GetText()) - aSymbols.RemoveEntry( aTmpOldSymbolName ); - // clear display for original symbol + const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), + sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), + aSymbolSets.GetText() ); + + // remove old symbol if the name was changed then add new one +// const bool bSetNameChanged = aOldSymbolSets.GetText() != aSymbolSets.GetText(); + const bool bNameChanged = aOldSymbols.GetText() != aSymbols.GetText(); + if (bNameChanged) + aSymbolMgrCopy.RemoveSymbol( aOldSymbols.GetText() ); + aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true ); + + // clear display for original symbol if necessary + if (bNameChanged) SetOrigSymbol(NULL, XubString()); - } - //!! den SymbolSet Manger dazu zwingen seinen HashTable zu aktualisieren, - //!! um mit moeglich neuen bzw fehlenden alten Symbol Namen konform zu sein. - aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1); + // update display of new symbol + aSymbolDisplay.SetChar( aNewSymbol.GetCharacter() ); + aSymbolDisplay.SetFont( aNewSymbol.GetFace() ); + aSymbolName.SetText( aNewSymbol.GetName() ); + aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() ); + + // update list box entries + FillSymbolSets(aOldSymbolSets, FALSE); + FillSymbolSets(aSymbolSets, FALSE); + FillSymbols(aOldSymbols ,FALSE); + FillSymbols(aSymbols ,FALSE); UpdateButtons(); @@ -2012,33 +1972,16 @@ IMPL_LINK( SmSymDefineDialog, DeleteClickHdl, Button *, EMPTYARG pButton ) if (pOrigSymbol) { - // loeschen des Symbols: - // - // zugehoeriges SymbolSet finden - SmSymSet *pSymSet = GetSymbolSet(aOldSymbolSets); - // finden des Index - XubString aTmpOldSymbolName (pOrigSymbol->GetName()); - USHORT nSymbolNo = pSymSet->GetSymbolPos(aTmpOldSymbolName); - // Bezuege auf das Symbols loeschen + aSymbolMgrCopy.RemoveSymbol( pOrigSymbol->GetName() ); + + // clear display for original symbol SetOrigSymbol(NULL, XubString()); - // und weg mit dem Symbol - pSymSet->DeleteSymbol(nSymbolNo); -#if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pSymSet, "Sm : NULL pointer"); - DBG_ASSERT(nSymbolNo != SYMBOL_NONE, "Sm : kein Symbol"); -#endif - //!! den SymbolSet Manger dazu zwingen seinen HashTable zu aktualisieren, - //!! was er naemlich nicht tut, wenn in einem seiner SymbolSets geaendert/ - //!! geloescht wird, was wiederum zu einem Absturz fuehren kann (wenn er - //!! ueber ein nicht mehr existentes aber nicht entferntes Symbol iteriert). - aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1); - - // aktualisieren der Symboleintraege des Dialogs - aOldSymbols.SetText(XubString()); - aOldSymbols.RemoveEntry(aTmpOldSymbolName); - if (aSymbolSets.GetText() == aOldSymbolSets.GetText()) - aSymbols.RemoveEntry(aTmpOldSymbolName); + // update list box entries + FillSymbolSets(aOldSymbolSets, FALSE); + FillSymbolSets(aSymbolSets, FALSE); + FillSymbols(aOldSymbols ,FALSE); + FillSymbols(aSymbols ,FALSE); } UpdateButtons(); @@ -2070,7 +2013,7 @@ void SmSymDefineDialog::UpdateButtons() && aCharsetDisplay.GetSelectCharacter() == pOrigSymbol->GetCharacter(); // hinzufuegen nur wenn es noch kein Symbol desgleichen Namens gibt - bAdd = aSymSetMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL; + bAdd = aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL; // loeschen nur wenn alle Einstellungen gleich sind bDelete = pOrigSymbol != NULL; @@ -2078,9 +2021,12 @@ void SmSymDefineDialog::UpdateButtons() // aendern wenn bei gleichem Namen mindestens eine Einstellung anders ist // oder wenn es noch kein Symbol des neuen Namens gibt (wuerde implizites // loeschen des bereits vorhandenen Symbols erfordern) - BOOL bEqualName = pOrigSymbol && aTmpSymbolName == pOrigSymbol->GetName(); - bChange = pOrigSymbol && ( (bEqualName && !bEqual) || (!bEqualName && bAdd) ); - } +// BOOL bEqualName = pOrigSymbol && aTmpSymbolName == pOrigSymbol->GetName(); +// bChange = pOrigSymbol && ( (bEqualName && !bEqual) || (!bEqualName && bAdd) ); + + // aendern nur falls altes Symbol vorhanden und am neuen etwas anders ist + bChange = pOrigSymbol && !bEqual; +} aAddBtn .Enable(bAdd); aChangeBtn.Enable(bChange); @@ -2089,7 +2035,7 @@ void SmSymDefineDialog::UpdateButtons() SmSymDefineDialog::SmSymDefineDialog(Window * pParent, - OutputDevice *pFntListDevice, SmSymSetManager &rMgr, BOOL bFreeRes) : + OutputDevice *pFntListDevice, SmSymbolManager &rMgr, BOOL bFreeRes) : ModalDialog (pParent, SmResId(RID_SYMDEFINEDIALOG)), aOldSymbolText (this, SmResId(1)), aOldSymbols (this, SmResId(1)), @@ -2120,7 +2066,7 @@ SmSymDefineDialog::SmSymDefineDialog(Window * pParent, aRightArrow (this, SmResId(1)), aRigthArrow_Im (SmResId(1)), aRigthArrow_Im_HC (SmResId(2)), // hi-contrast version - rSymSetMgr (rMgr), + rSymbolMgr (rMgr), pSubsetMap (NULL), pFontList (NULL) { @@ -2131,9 +2077,10 @@ SmSymDefineDialog::SmSymDefineDialog(Window * pParent, pOrigSymbol = 0; - // make autocompletion for symbols case-sensitive - aOldSymbols.EnableAutocomplete(TRUE, TRUE); - aSymbols .EnableAutocomplete(TRUE, TRUE); + // auto completion is troublesome since that symbols character also gets automatically selected in the + // display and if the user previously selected a character to define/redefine that one this is bad + aOldSymbols.EnableAutocomplete( FALSE, TRUE ); + aSymbols .EnableAutocomplete( FALSE, TRUE ); FillFonts(); if (aFonts.GetEntryCount() > 0) @@ -2141,7 +2088,7 @@ SmSymDefineDialog::SmSymDefineDialog(Window * pParent, InitColor_Impl(); - SetSymbolSetManager(rSymSetMgr); + SetSymbolSetManager(rSymbolMgr); aOldSymbols .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl)); aOldSymbolSets .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl)); @@ -2215,41 +2162,23 @@ short SmSymDefineDialog::Execute() short nResult = ModalDialog::Execute(); // Aenderungen uebernehmen falls Dialog mit OK beendet wurde - if (aSymSetMgrCopy.IsModified() && nResult == RET_OK) - { - // leere SymbolSets aus dem Ergebnis entfernen. - // Dabei von hinten durch das array iterieren, da beim loeschen die - // Elemente aufruecken. - USHORT nSymbolSets = aSymSetMgrCopy.GetSymbolSetCount(); - for (USHORT i = 0; i < nSymbolSets; i++) - { - USHORT nIdx = nSymbolSets - 1 - i; - if (aSymSetMgrCopy.GetSymbolSet(nIdx)->GetCount() == 0) - aSymSetMgrCopy.DeleteSymbolSet(nIdx); - } - - - - rSymSetMgr = aSymSetMgrCopy; -#ifdef DEBUG -// USHORT nS = rSymSetMgr.GetSymbolSetCount(); -#endif - } + if (aSymbolMgrCopy.IsModified() && nResult == RET_OK) + rSymbolMgr = aSymbolMgrCopy; return nResult; } -void SmSymDefineDialog::SetSymbolSetManager(const SmSymSetManager &rMgr) +void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr) { - aSymSetMgrCopy = rMgr; + aSymbolMgrCopy = rMgr; #ifdef DEBUG -// USHORT nS = aSymSetMgrCopy.GetSymbolSetCount(); +// USHORT nS = aSymbolMgrCopy.GetSymbolSetCount(); #endif // Das modified Flag der Kopie auf FALSE setzen, damit man spaeter damit // testen kann ob sich was geaendert hat. - aSymSetMgrCopy.SetModified(FALSE); + aSymbolMgrCopy.SetModified(FALSE); FillSymbolSets(aOldSymbolSets); if (aOldSymbolSets.GetEntryCount() > 0) @@ -2404,13 +2333,13 @@ BOOL SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox, { // bei Wechsel des alten Symbols nur vorhandene anzeigen sonst keins const SmSym *pOldSymbol = NULL; - XubString aTMpOldSymbolSetName; + XubString aTmpOldSymbolSetName; if (nPos != COMBOBOX_ENTRY_NOTFOUND) { - pOldSymbol = aSymSetMgrCopy.GetSymbolByName(aNormName); - aTMpOldSymbolSetName = aOldSymbolSets.GetText(); + pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName); + aTmpOldSymbolSetName = aOldSymbolSets.GetText(); } - SetOrigSymbol(pOldSymbol, aTMpOldSymbolSetName); + SetOrigSymbol(pOldSymbol, aTmpOldSymbolSetName); } else aSymbolName.SetText(rComboBox.GetText()); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ff2d5bed71a2..49739af72972 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -143,8 +143,8 @@ void SmDocShell::LoadSymbols() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::LoadSymbols" ); - SmModule *pp = SM_MOD1(); - pp->GetSymSetManager().Load(); + SmModule *pp = SM_MOD(); + pp->GetSymbolManager().Load(); } @@ -274,7 +274,7 @@ void SmDocShell::ArrangeFormula() pOutDev = &pView->GetGraphicWindow(); else { - pOutDev = &SM_MOD1()->GetDefaultVirtualDev(); + pOutDev = &SM_MOD()->GetDefaultVirtualDev(); pOutDev->SetMapMode( MapMode(MAP_100TH_MM) ); } } @@ -608,7 +608,7 @@ Printer* SmDocShell::GetPrt() SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, 0); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pOptions); pPrinter = new SfxPrinter(pOptions); pPrinter->SetMapMode( MapMode(MAP_100TH_MM) ); @@ -690,7 +690,7 @@ SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) : SetPool(&SFX_APP()->GetPool()); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); aFormat = pp->GetConfig()->GetStandardFormat(); StartListening(aFormat); @@ -705,7 +705,7 @@ SmDocShell::~SmDocShell() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::~SmDocShell" ); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); EndListening(aFormat); EndListening(*pp->GetConfig()); @@ -1001,7 +1001,7 @@ void SmDocShell::Execute(SfxRequest& rReq) case SID_AUTO_REDRAW : { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); BOOL bRedraw = pp->GetConfig()->IsAutoRedraw(); pp->GetConfig()->SetAutoRedraw(!bRedraw); } @@ -1020,7 +1020,7 @@ void SmDocShell::Execute(SfxRequest& rReq) // get device used to retrieve the FontList OutputDevice *pDev = GetPrinter(); if (!pDev || pDev->GetDevFontCount() == 0) - pDev = &SM_MOD1()->GetDefaultVirtualDev(); + pDev = &SM_MOD()->GetDefaultVirtualDev(); DBG_ASSERT (pDev, "device for font list missing" ); SmFontTypeDialog *pFontTypeDialog = new SmFontTypeDialog( NULL, pDev ); @@ -1104,7 +1104,7 @@ void SmDocShell::Execute(SfxRequest& rReq) pAlignDialog->WriteTo(aNewFormat); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); pAlignDialog->WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); @@ -1201,7 +1201,7 @@ void SmDocShell::GetState(SfxItemSet &rSet) case SID_AUTO_REDRAW : { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); BOOL bRedraw = pp->GetConfig()->IsAutoRedraw(); rSet.Put(SfxBoolItem(SID_AUTO_REDRAW, bRedraw)); @@ -1290,8 +1290,8 @@ void SmDocShell::SaveSymbols() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::SaveSymbols" ); - SmModule *pp = SM_MOD1(); - pp->GetSymSetManager().Save(); + SmModule *pp = SM_MOD(); + pp->GetSymbolManager().Save(); } diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 94e30ce82501..f7093f9c3815 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -113,14 +113,13 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : // Even RTL languages don't use RTL for math rCmdBox.GetEditWindow()->EnableRTL( FALSE ); - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); // compare DataChanged SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl)); - aModifyTimer.SetTimeout(2000); - aModifyTimer.Start(); + aModifyTimer.SetTimeout(500); aCursorMoveTimer.SetTimeoutHdl(LINK(this, SmEditWindow, CursorMoveTimerHdl)); aCursorMoveTimer.SetTimeout(500); @@ -216,7 +215,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) { const StyleSettings aSettings( GetSettings().GetStyleSettings() ); - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); SetBackground( aSettings.GetWindowColor() ); // edit fields in other Applications use this font instead of @@ -250,10 +249,9 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ ) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); if (pp->GetConfig()->IsAutoRedraw()) Flush(); - aModifyTimer.Start(); return 0; } @@ -882,7 +880,10 @@ void SmEditWindow::Cut() { DBG_ASSERT( pEditView, "EditView missing" ); if (pEditView) + { pEditView->Cut(); + GetDoc()->SetModified( TRUE ); + } } void SmEditWindow::Copy() @@ -896,14 +897,20 @@ void SmEditWindow::Paste() { DBG_ASSERT( pEditView, "EditView missing" ); if (pEditView) + { pEditView->Paste(); + GetDoc()->SetModified( TRUE ); + } } void SmEditWindow::Delete() { DBG_ASSERT( pEditView, "EditView missing" ); if (pEditView) + { pEditView->DeleteSelected(); + GetDoc()->SetModified( TRUE ); + } } void SmEditWindow::InsertText(const String& Text) diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index a69a90010700..b8256514f453 100644 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -48,32 +48,32 @@ SRC2FILES = smres.src \ commands.src SLO1FILES = \ - $(SLO)$/register.obj \ - $(SLO)$/typemap.obj \ + $(SLO)$/accessibility.obj \ + $(SLO)$/edit.obj \ + $(SLO)$/eqnolefilehdr.obj \ + $(SLO)$/mathmlexport.obj \ + $(SLO)$/mathmlimport.obj \ $(SLO)$/symbol.obj \ - $(SLO)$/toolbox.obj \ + $(SLO)$/types.obj \ + $(SLO)$/unodoc.obj \ $(SLO)$/action.obj \ - $(SLO)$/accessibility.obj \ $(SLO)$/cfgitem.obj \ $(SLO)$/config.obj \ $(SLO)$/dialog.obj \ $(SLO)$/document.obj \ - $(SLO)$/mathtype.obj \ - $(SLO)$/mathmlimport.obj \ - $(SLO)$/mathmlexport.obj \ $(SLO)$/format.obj \ + $(SLO)$/mathtype.obj \ $(SLO)$/node.obj \ $(SLO)$/parse.obj \ - $(SLO)$/utility.obj \ + $(SLO)$/register.obj \ $(SLO)$/smdll.obj \ + $(SLO)$/toolbox.obj \ + $(SLO)$/typemap.obj \ $(SLO)$/smmod.obj \ - $(SLO)$/types.obj \ - $(SLO)$/view.obj \ - $(SLO)$/edit.obj \ + $(SLO)$/utility.obj \ $(SLO)$/rect.obj \ $(SLO)$/unomodel.obj \ - $(SLO)$/unodoc.obj \ - $(SLO)$/eqnolefilehdr.obj + $(SLO)$/view.obj SLO2FILES = \ $(SLO)$/register.obj \ diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 722df5a1d502..9999205ad83f 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -115,7 +115,7 @@ Color SmTmpDevice::Impl_GetColor( const Color& rColor ) if (OUTDEV_WINDOW == rOutDev.GetOutDevType()) aBgCol = ((Window &) rOutDev).GetDisplayBackground().GetColor(); - nNewCol = SM_MOD1()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; + nNewCol = SM_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; Color aTmpColor( nNewCol ); if (aBgCol.IsDark() && aTmpColor.IsDark()) @@ -2803,9 +2803,9 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell SmNode::Prepare(rFormat, rDocShell); const SmSym *pSym; - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); - if (NULL != (pSym = pp->GetSymSetManager().GetSymbolByName(GetToken().aText))) + if (NULL != (pSym = pp->GetSymbolManager().GetSymbolByName(GetToken().aText))) { SetText( pSym->GetCharacter() ); GetFont() = pSym->GetFace(); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 1955b0553b62..9b18f6a427a1 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -380,7 +380,7 @@ BOOL SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos ) BOOL bIsDelim = *pDelim != 0; - INT16 nTypJp = SM_MOD1()->GetSysLocale().GetCharClass().getType( rTxt, nPos ); + INT16 nTypJp = SM_MOD()->GetSysLocale().GetCharClass().getType( rTxt, nPos ); bIsDelim |= nTypJp == com::sun::star::i18n::UnicodeType::SPACE_SEPARATOR || nTypJp == com::sun::star::i18n::UnicodeType::CONTROL; @@ -438,7 +438,7 @@ void SmParser::NextToken() xub_StrLen nRealStart; BOOL bCont; BOOL bNumStart = FALSE; - CharClass aCC(SM_MOD1()->GetSysLocale().GetCharClass().getLocale()); + CharClass aCC(SM_MOD()->GetSysLocale().GetCharClass().getLocale()); do { // skip white spaces @@ -1362,7 +1362,7 @@ void SmParser::Blank() // Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist if ( CurToken.eType == TNEWLINE || - (CurToken.eType == TEND && SM_MOD1()->GetConfig()->IsIgnoreSpacesRight()) ) + (CurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) ) { pBlankNode->Clear(); } @@ -2286,13 +2286,13 @@ void SmParser::Special() // UI uses localized names XML file format does not.) if (IsImportSymbolNames()) { - const SmLocalizedSymbolData &rLSD = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); aNewName = rLSD.GetUiSymbolName( rName ); bReplace = TRUE; } else if (IsExportSymbolNames()) { - const SmLocalizedSymbolData &rLSD = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); aNewName = rLSD.GetExportSymbolName( rName ); bReplace = TRUE; } @@ -2300,7 +2300,7 @@ void SmParser::Special() else // 5.0 <-> 6.0 formula text (symbol name) conversion { LanguageType nLanguage = GetLanguage(); - SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray *pFrom = 0; const ResStringArray *pTo = 0; if (CONVERT_50_TO_60 == GetConversion()) diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index 02df2ddf060e..248983a393a8 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -715,7 +715,7 @@ BOOL SmGetGlyphBoundRect(const OutputDevice &rDev, { // since we format for the printer (where GetTextBoundRect will fail) // we need a virtual device here. - pGlyphDev = &SM_MOD1()->GetDefaultVirtualDev(); + pGlyphDev = &SM_MOD()->GetDefaultVirtualDev(); } const FontMetric aDevFM (rDev.GetFontMetric()); diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx index f72ab2be84cb..a66ec8efc608 100644 --- a/starmath/source/smdll.cxx +++ b/starmath/source/smdll.cxx @@ -76,7 +76,7 @@ void SmDLL::Init() SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM); *ppShlPtr = new SmModule( &rFactory ); - SfxModule *p = SM_MOD1(); + SfxModule *p = SM_MOD(); SmModule *pp = (SmModule *) p; rFactory.SetDocumentServiceName( String::CreateFromAscii("com.sun.star.formula.FormulaProperties") ); diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 451bb8664bc5..da6259076adc 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -98,7 +98,7 @@ const String SmLocalizedSymbolData::GetUiSymbolName( const String &rExportName ) { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rExportNames.Count()); @@ -119,7 +119,7 @@ const String SmLocalizedSymbolData::GetExportSymbolName( const String &rUiName ) { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rUiNames.Count()); @@ -140,7 +140,7 @@ const String SmLocalizedSymbolData::GetUiSymbolSetName( const String &rExportNam { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rExportNames.Count()); @@ -161,7 +161,7 @@ const String SmLocalizedSymbolData::GetExportSymbolSetName( const String &rUiNam { String aRes; - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData(); const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray(); const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray(); USHORT nCount = sal::static_int_cast< xub_StrLen >(rUiNames.Count()); @@ -311,9 +311,9 @@ SmConfig * SmModule::GetConfig() return pConfig; } -SmSymSetManager & SmModule::GetSymSetManager() +SmSymbolManager & SmModule::GetSymbolManager() { - return GetConfig()->GetSymSetManager(); + return GetConfig()->GetSymbolManager(); } SmLocalizedSymbolData & SmModule::GetLocSymbolData() const diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 7d2799b71647..395ca9ce8cdb 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -34,12 +34,13 @@ #include <ucbhelper/content.hxx> #include <vcl/msgbox.hxx> -#ifndef _SV_RESARY_HXX -#include <tools/resary.hxx> -#endif #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> +#include <map> +#include <vector> +#include <iterator> + #include "symbol.hxx" #include "view.hxx" #include "utility.hxx" @@ -55,72 +56,38 @@ using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::uno; using namespace ::rtl; -// Das hier muss auch mal alles "uberarbeitet werden. Insbesondere die nicht -// funktionierende und bei l"oschen/"andern von Symbolen nicht gepflegte -// Hash Tabelle!!! Diese aktualisert sich erst im Wertzuweisungsoperator -// beim Verlassen des 'SmSymDefineDialog's! - -/**************************************************************************/ -/* -** -** MACRO DEFINTION -** -**/ - -#define SF_SM20IDENT 0x03031963L -#define SF_IDENT 0x30334D53L - - -SV_IMPL_PTRARR( SymbolArray, SmSym * ); - -/**************************************************************************/ -/* -** -** DATA DEFINITION -** -**/ - -long SF_Ident = SF_IDENT; /**************************************************************************/ -/* -** -** CLASS IMPLEMENTATION -** -**/ SmSym::SmSym() : - Name(C2S("unknown")), - aSetName(C2S("unknown")), - pHashNext(0), - pSymSetManager(0), - Character('\0'), - bPredefined(FALSE), - bDocSymbol(FALSE) + m_aName(C2S("unknown")), + m_aSetName(C2S("unknown")), + m_cChar('\0'), + m_bPredefined(FALSE), + m_bDocSymbol(FALSE) { - aExportName = Name; - Face.SetTransparent(TRUE); - Face.SetAlign(ALIGN_BASELINE); + m_aExportName = m_aName; + m_aFace.SetTransparent(TRUE); + m_aFace.SetAlign(ALIGN_BASELINE); } SmSym::SmSym(const SmSym& rSymbol) { - pSymSetManager = 0; *this = rSymbol; } -SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar, +SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode cChar, const String& rSet, BOOL bIsPredefined) { - Name = aExportName = rName; + m_aName = m_aExportName = rName; - Face = rFont; - Face.SetTransparent(TRUE); - Face.SetAlign(ALIGN_BASELINE); + m_aFace = rFont; + m_aFace.SetTransparent(TRUE); + m_aFace.SetAlign(ALIGN_BASELINE); - Character = aChar; + m_cChar = cChar; //! according to HDU this should not be used anymore now //! since this was necessary in the early days but should //! not be done now since this is handled now at a more @@ -132,481 +99,231 @@ SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar, // // if (RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet()) // Character |= 0xF000; - aSetName = rSet; - bPredefined = bIsPredefined; - bDocSymbol = FALSE; - - pHashNext = 0; - pSymSetManager = 0; + m_aSetName = rSet; + m_bPredefined = bIsPredefined; + m_bDocSymbol = FALSE; } SmSym& SmSym::operator = (const SmSym& rSymbol) { - Name = rSymbol.Name; - Face = rSymbol.Face; - Character = rSymbol.Character; - aSetName = rSymbol.aSetName; - bPredefined = rSymbol.bPredefined; - bDocSymbol = rSymbol.bDocSymbol; - aExportName = rSymbol.aExportName; - - pHashNext = 0; - - if (pSymSetManager) - pSymSetManager->SetModified(TRUE); - - return *this; -} - -/**************************************************************************/ - -SmSymSet::SmSymSet() : - Name(C2S("unknown")), - pSymSetManager(0) -{ - SymbolList.Clear(); -} - -SmSymSet::SmSymSet(const SmSymSet& rSymbolSet) -{ - pSymSetManager = 0; - *this = rSymbolSet; -} - -SmSymSet::SmSymSet(const String& rName) -{ - Name = rName; - SymbolList.Clear(); - - pSymSetManager = 0; -} - -SmSymSet::~SmSymSet() -{ - for (USHORT i = 0; i < GetCount(); i++) - delete SymbolList.GetObject(i); -} - -SmSymSet& SmSymSet::operator = (const SmSymSet& rSymbolSet) -{ - USHORT i; - for (i = 0; i < GetCount(); i++) - delete SymbolList.GetObject(i); - - Name = rSymbolSet.Name; - SymbolList.Clear(); - for (i = 0; i < rSymbolSet.GetCount(); i++) - AddSymbol(new SmSym(rSymbolSet.GetSymbol(i))); + m_aName = rSymbol.m_aName; + m_aExportName = rSymbol.m_aExportName; + m_cChar = rSymbol.m_cChar; + m_aFace = rSymbol.m_aFace; + m_aSetName = rSymbol.m_aSetName; + m_bPredefined = rSymbol.m_bPredefined; + m_bDocSymbol = rSymbol.m_bDocSymbol; + SmSymbolManager * pSymSetManager = &SM_MOD()->GetSymbolManager(); if (pSymSetManager) - pSymSetManager->SetModified(TRUE); + pSymSetManager->SetModified(true); return *this; } -USHORT SmSymSet::AddSymbol(SmSym* pSymbol) -{ - DBG_ASSERT(pSymbol, "Kein Symbol"); - - if (pSymbol) - pSymbol->SetSetName( GetName() ); - SymbolList.Insert(pSymbol, LIST_APPEND); - DBG_ASSERT(SymbolList.GetPos(pSymbol) == SymbolList.Count() - 1, - "Sm : ... ergibt falschen return Wert"); - - if (pSymSetManager) - pSymSetManager->SetModified(TRUE); - - return (USHORT) SymbolList.Count() - 1; -} - -void SmSymSet::DeleteSymbol(USHORT SymbolNo) -{ - delete RemoveSymbol(SymbolNo); -} - -SmSym * SmSymSet::RemoveSymbol(USHORT SymbolNo) -{ - DBG_ASSERT(SymbolList.GetObject(SymbolNo), "Symbol nicht vorhanden"); - - SmSym *pSym = SymbolList.GetObject(SymbolNo); - SymbolList.Remove(SymbolNo); - - if (pSymSetManager) - pSymSetManager->SetModified(TRUE); - - return pSym; -} - -USHORT SmSymSet::GetSymbolPos(const String& rName) -{ - for (USHORT i = 0; i < GetCount(); i++) - if (SymbolList.GetObject(i)->GetName() == rName) - return (i); - return SYMBOL_NONE; -} - -/**************************************************************************/ - -SmSymSetManager_Impl::SmSymSetManager_Impl( - SmSymSetManager &rMgr, USHORT HashTableSize ) : - - rSymSetMgr (rMgr) -{ - NoSymbolSets = 0; - NoHashEntries = HashTableSize; - HashEntries = new SmSym *[NoHashEntries]; - memset( HashEntries, 0, sizeof(SmSym *) * NoHashEntries ); - Modified = FALSE; -} - - -SmSymSetManager_Impl::~SmSymSetManager_Impl() +bool SmSym::IsEqualInUI( const SmSym& rSymbol ) const { - for (USHORT i = 0; i < NoSymbolSets; ++i) - delete SymbolSets.Get(i); - SymbolSets.Clear(); - - NoSymbolSets = 0; - if (HashEntries) - { - delete[] HashEntries; - HashEntries = 0; - } - NoHashEntries = 0; - Modified = FALSE; -} - - -SmSymSetManager_Impl & SmSymSetManager_Impl::operator = ( const SmSymSetManager_Impl &rImpl ) -{ - //! rMySymSetMgr remains unchanged - - NoHashEntries = rImpl.NoHashEntries; - if (HashEntries) - delete [] HashEntries; - HashEntries = new SmSym *[NoHashEntries]; - memset( HashEntries, 0, sizeof(SmSym *) * NoHashEntries ); - - NoSymbolSets = 0; - SymbolSets.Clear(); - for (USHORT i = 0; i < rImpl.NoSymbolSets; ++i) - { - rSymSetMgr.AddSymbolSet( new SmSymSet( *rImpl.rSymSetMgr.GetSymbolSet(i) ) ); - } - DBG_ASSERT( NoSymbolSets == rImpl.NoSymbolSets, - "incorrect number of symbolsets" ); - - Modified = TRUE; - return *this; + return m_aName == rSymbol.m_aName && + m_aFace == rSymbol.m_aFace && + m_cChar == rSymbol.m_cChar; } /**************************************************************************/ -void SmSymSetManager::SFX_NOTIFY(SfxBroadcaster& /*rBC*/, const TypeId& rBCType, +void SmSymbolManager::SFX_NOTIFY(SfxBroadcaster& /*rBC*/, const TypeId& rBCType, const SfxHint& /*rHint*/, const TypeId& rHintType) { } -UINT32 SmSymSetManager::GetHashIndex(const String& rSymbolName) -{ - UINT32 x = 1; - for (xub_StrLen i = 0; i < rSymbolName.Len(); i++) - x += x * rSymbolName.GetChar(i) + i; - - return x % pImpl->NoHashEntries; -} - - -void SmSymSetManager::EnterHashTable(SmSym& rSymbol) -{ - int j = GetHashIndex( rSymbol.GetName() ); - if (pImpl->HashEntries[j] == 0) - pImpl->HashEntries[j] = &rSymbol; - else - { - SmSym *p = pImpl->HashEntries[j]; - while (p->pHashNext) - p = p->pHashNext; - p->pHashNext = &rSymbol; - } - rSymbol.pHashNext = 0; -} - - -void SmSymSetManager::EnterHashTable(SmSymSet& rSymbolSet) -{ - for (USHORT i = 0; i < rSymbolSet.GetCount(); i++) - EnterHashTable( *rSymbolSet.SymbolList.GetObject(i) ); -} - -void SmSymSetManager::FillHashTable() -{ - if (pImpl->HashEntries) - { - memset( pImpl->HashEntries, 0, pImpl->NoHashEntries * sizeof(SmSym *) ); - - for (UINT32 i = 0; i < pImpl->NoSymbolSets; i++) - EnterHashTable( *GetSymbolSet( (USHORT) i ) ); - } -} - -void SmSymSetManager::Init() +void SmSymbolManager::Init() { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); StartListening(*pp->GetConfig()); } -void SmSymSetManager::Exit() +void SmSymbolManager::Exit() { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); EndListening(*pp->GetConfig()); } -SmSymSetManager::SmSymSetManager(USHORT HashTableSize) +SmSymbolManager::SmSymbolManager() { - pImpl = new SmSymSetManager_Impl( *this, HashTableSize ); + m_bModified = false; } -SmSymSetManager::SmSymSetManager(const SmSymSetManager& rSymbolSetManager) : +SmSymbolManager::SmSymbolManager(const SmSymbolManager& rSymbolSetManager) : SfxListener() { - pImpl = new SmSymSetManager_Impl( *this, rSymbolSetManager.pImpl->NoHashEntries ); - *pImpl = *rSymbolSetManager.pImpl; + m_aSymbols = rSymbolSetManager.m_aSymbols; + m_bModified = true; } -SmSymSetManager::~SmSymSetManager() +SmSymbolManager::~SmSymbolManager() { - delete pImpl; - pImpl = 0; } -SmSymSetManager& SmSymSetManager::operator = (const SmSymSetManager& rSymbolSetManager) + +SmSymbolManager& SmSymbolManager::operator = (const SmSymbolManager& rSymbolSetManager) { - *pImpl = *rSymbolSetManager.pImpl; + m_aSymbols = rSymbolSetManager.m_aSymbols; + m_bModified = true; return *this; } -USHORT SmSymSetManager::AddSymbolSet(SmSymSet* pSymbolSet) -{ - if (pImpl->NoSymbolSets >= pImpl->SymbolSets.GetSize()) - pImpl->SymbolSets.SetSize(pImpl->NoSymbolSets + 1); - - pImpl->SymbolSets.Put(pImpl->NoSymbolSets++, pSymbolSet); - pSymbolSet->pSymSetManager = this; - - for (USHORT i = 0; i < pSymbolSet->GetCount(); i++) - pSymbolSet->SymbolList.GetObject(i)->pSymSetManager = this; - - FillHashTable(); - pImpl->Modified = TRUE; - - return (USHORT) (pImpl->NoSymbolSets - 1); -} - -void SmSymSetManager::ChangeSymbolSet(SmSymSet* pSymbolSet) +SmSym *SmSymbolManager::GetSymbolByName(const String& rSymbolName) { - if (pSymbolSet) - { - FillHashTable(); - pImpl->Modified = TRUE; - } + SmSym *pRes = NULL; + SymbolMap_t::iterator aIt( m_aSymbols.find( rSymbolName ) ); + if (aIt != m_aSymbols.end()) + pRes = &aIt->second; + return pRes; } -void SmSymSetManager::DeleteSymbolSet(USHORT SymbolSetNo) -{ - delete pImpl->SymbolSets.Get(SymbolSetNo); - pImpl->NoSymbolSets--; - - for (UINT32 i = SymbolSetNo; i < pImpl->NoSymbolSets; i++) - pImpl->SymbolSets.Put(i, pImpl->SymbolSets.Get(i + 1)); - - FillHashTable(); - pImpl->Modified = TRUE; +const SymbolPtrVec_t SmSymbolManager::GetSymbols() const +{ + SymbolPtrVec_t aRes; + SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); + for ( ; aIt != m_aSymbols.end(); ++aIt) + aRes.push_back( &aIt->second ); + DBG_ASSERT( sSymbols.size() == m_aSymbols.size(), "number of symbols mismatch " ); + return aRes; } -USHORT SmSymSetManager::GetSymbolSetPos(const String& rSymbolSetName) const +bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChange ) { - for (USHORT i = 0; i < pImpl->NoSymbolSets; i++) - if (pImpl->SymbolSets.Get(i)->GetName() == rSymbolSetName) - return (i); - - return SYMBOLSET_NONE; -} + bool bAdded = false; -SmSym *SmSymSetManager::GetSymbolByName(const String& rSymbolName) -{ - SmSym *pSym = pImpl->HashEntries[GetHashIndex(rSymbolName)]; - while (pSym) + const String aSymbolName( rSymbol.GetName() ); + if (aSymbolName.Len() > 0 && rSymbol.GetSymbolSetName().Len() > 0) { - if (pSym->Name == rSymbolName) - break; - pSym = pSym->pHashNext; - } - - return pSym; -} + const SmSym *pFound = GetSymbolByName( aSymbolName ); + const bool bSymbolConflict = pFound && !pFound->IsEqualInUI( rSymbol ); - -void SmSymSetManager::AddReplaceSymbol( const SmSym &rSymbol ) -{ - SmSym *pSym = GetSymbolByName( rSymbol.GetName() ); - if (pSym) - { - *pSym = rSymbol; - } - else - { - USHORT nPos = GetSymbolSetPos( rSymbol.GetSetName() ); - if (SYMBOLSET_NONE == nPos) + // avoid having the same symbol name twice but with different symbols in use + if (!pFound || bForceChange) { - AddSymbolSet( new SmSymSet( rSymbol.GetSetName() ) ); - nPos = GetSymbolSetPos( rSymbol.GetSetName() ); + m_aSymbols[ aSymbolName ] = rSymbol; + bAdded = true; + } + else if (pFound && !bForceChange && bSymbolConflict) + { + // TODO: but what ... + DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" ); } - DBG_ASSERT( nPos != SYMBOLSET_NONE, "SymbolSet not found"); - SmSym *pTmpSym = new SmSym( rSymbol ); - GetSymbolSet( nPos )->AddSymbol( pTmpSym ); - EnterHashTable( *pTmpSym ); } - SetModified( TRUE ); -} + DBG_ASSERT( bAdded, "failed to add symbol" ); + if (bAdded) + m_bModified = true; -USHORT SmSymSetManager::GetSymbolCount() const -{ - USHORT nRes = 0; - USHORT nSets = GetSymbolSetCount(); - for (USHORT i = 0; i < nSets; ++i) - nRes = nRes + GetSymbolSet(i)->GetCount(); - return nRes; + return bAdded; } -const SmSym * SmSymSetManager::GetSymbolByPos( USHORT nPos ) const +void SmSymbolManager::RemoveSymbol( const String & rSymbolName ) { - const SmSym *pRes = 0; - - INT16 nIdx = 0; - USHORT nSets = GetSymbolSetCount(); - USHORT i = 0; - while (i < nSets && !pRes) + if (rSymbolName.Len() > 0) { - USHORT nEntries = GetSymbolSet(i)->GetCount(); - if (nPos < nIdx + nEntries) - pRes = &GetSymbolSet(i)->GetSymbol( nPos - nIdx ); - else - nIdx = nIdx + nEntries; - ++i; + size_t nOldSize = m_aSymbols.size(); + m_aSymbols.erase( rSymbolName ); + m_bModified = nOldSize != m_aSymbols.size(); } +} - return pRes; + +std::set< String > SmSymbolManager::GetSymbolSetNames() const +{ + std::set< String > aRes; + SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); + for ( ; aIt != m_aSymbols.end(); ++aIt ) + aRes.insert( aIt->second.GetSymbolSetName() ); + return aRes; } -void SmSymSetManager::GetSymbols( std::vector< SmSym > &rSymbols ) const +const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const String& rSymbolSetName ) { - INT32 nCount = GetSymbolCount(); - rSymbols.resize( nCount ); - USHORT nPos = 0; - std::vector< SmSym >::iterator aIt( rSymbols.begin() ); - std::vector< SmSym >::iterator aEnd( rSymbols.end() ); - while (aIt != aEnd) + SymbolPtrVec_t aRes; + if (rSymbolSetName.Len() > 0) { - const SmSym *pSym = GetSymbolByPos( nPos++ ); - DBG_ASSERT( pSym, "symbol missing" ); - if (pSym) - *aIt++ = *pSym; + SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); + for ( ; aIt != m_aSymbols.end(); ++aIt ) + { + if (aIt->second.GetSymbolSetName() == rSymbolSetName) + aRes.push_back( &aIt->second ); + } } - DBG_ASSERT( nPos == nCount, "index out of range?" ); + return aRes; } -void SmSymSetManager::Load() +void SmSymbolManager::Load() { std::vector< SmSym > aSymbols; - SmMathConfig &rCfg = *SM_MOD1()->GetConfig(); + SmMathConfig &rCfg = *SM_MOD()->GetConfig(); rCfg.GetSymbols( aSymbols ); - INT32 nSymbolCount = aSymbols.size(); + size_t nSymbolCount = aSymbols.size(); - USHORT i; - for (i = 0; i < nSymbolCount; ++i) + m_aSymbols.clear(); + for (size_t i = 0; i < nSymbolCount; ++i) { const SmSym &rSym = aSymbols[i]; - DBG_ASSERT( rSym.Name.Len() > 0, "symbol without name!" ); - if (rSym.Name.Len() > 0) - { - SmSymSet *pSymSet = 0; - const String &rSetName = rSym.GetSetName(); - USHORT nSetPos = GetSymbolSetPos( rSetName ); - if (SYMBOLSET_NONE != nSetPos) - pSymSet = GetSymbolSet( nSetPos ); - else - { - pSymSet = new SmSymSet( rSetName ); - AddSymbolSet( pSymSet ); - } - - pSymSet->AddSymbol( new SmSym( rSym ) ); - } + DBG_ASSERT( rSym.GetName().Len() > 0, "symbol without name!" ); + if (rSym.GetName().Len() > 0) + AddOrReplaceSymbol( rSym ); } - // build HashTables - INT32 nSymbolSetCount = GetSymbolSetCount(); - for (i = 0; i < nSymbolSetCount; ++i) - ChangeSymbolSet( GetSymbolSet( i ) ); + m_bModified = true; if (0 == nSymbolCount) { DBG_ERROR( "no symbol set found" ); - pImpl->Modified = FALSE; + m_bModified = false; } } -void SmSymSetManager::Save() +void SmSymbolManager::Save() { - SmMathConfig &rCfg = *SM_MOD1()->GetConfig(); - - // get number of Symbols - USHORT nSymbolCount = 0; - USHORT nSetCount = GetSymbolSetCount(); - USHORT i; - for (i = 0; i < nSetCount; ++i) - nSymbolCount = nSymbolCount + GetSymbolSet( i )->GetCount(); - - if (nSymbolCount) + if (m_bModified) { - USHORT nSaveSymbolCnt = 0; - const SmSym **pSymbols = new const SmSym* [ nSymbolCount ]; - const SmSym **pSym = pSymbols; - for (i = 0; i < nSetCount; ++i) + SmMathConfig &rCfg = *SM_MOD()->GetConfig(); + +#if 0 + USHORT nSymbolCount = GetSymbolCount(); + USHORT nSaveSymbolCnt = 0; + const SmSym **pSymbols = new const SmSym* [ nSymbolCount ]; + const SmSym **pSym = pSymbols; + for (USHORT j = 0; j < nSymbolCount; ++j) { - const SmSymSet *pSymSet = GetSymbolSet( i ); - USHORT n = pSymSet->GetCount(); - for (USHORT j = 0; j < n; ++j) + const SmSym &rSym = *pSymSet->GetSymbol( j ); + if (!rSym.IsDocSymbol()) { - const SmSym &rSym = pSymSet->GetSymbol( j ); - if (!rSym.IsDocSymbol()) - { - *pSym++ = &rSym; - ++nSaveSymbolCnt; - } + *pSym++ = &rSym; + ++nSaveSymbolCnt; } } DBG_ASSERT(pSym - pSymbols == nSaveSymbolCnt, "wrong number of symbols" ); - +#endif + SymbolPtrVec_t aTmp( GetSymbols() ); std::vector< SmSym > aSymbols; - GetSymbols( aSymbols ); + for (size_t i = 0; i < aTmp.size(); ++i) + aSymbols.push_back( *aTmp[i] ); rCfg.SetSymbols( aSymbols ); +#if 0 delete [] pSymbols; +#endif + + m_bModified = false; } } diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index f4acc1af6b89..013831f6e44e 100644..100755 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -85,7 +85,7 @@ SmPrintUIOptions::SmPrintUIOptions() if( aLocalizedStrings.Count() < 18 ) // bad resource ? return; - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); SmConfig *pConfig = pp->GetConfig(); DBG_ASSERT( pConfig, "SmConfig not found" ); if (!pConfig) @@ -684,7 +684,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* 0 }; SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange ); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pItemSet); SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); @@ -701,8 +701,8 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* if ( *pValues >>= aSequence ) { sal_uInt32 nSize = aSequence.getLength(); - SmModule *pp = SM_MOD1(); - SmSymSetManager &rManager = pp->GetSymSetManager(); + SmModule *pp = SM_MOD(); + SmSymbolManager &rManager = pp->GetSymbolManager(); SymbolDescriptor *pDescriptor = aSequence.getArray(); for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++) { @@ -717,7 +717,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pDescriptor->sSymbolSet ); aSymbol.SetExportName ( pDescriptor->sExportName ); aSymbol.SetDocSymbol( TRUE ); - rManager.AddReplaceSymbol ( aSymbol ); + rManager.AddOrReplaceSymbol ( aSymbol ); } } else @@ -886,14 +886,15 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu case HANDLE_SYMBOLS: { // this is get - SmModule *pp = SM_MOD1(); - const SmSymSetManager &rManager = pp->GetSymSetManager(); + SmModule *pp = SM_MOD(); + const SmSymbolManager &rManager = pp->GetSymbolManager(); vector < const SmSym * > aVector; - USHORT nCount = 0; - for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++) + const SymbolPtrVec_t aSymbols( rManager.GetSymbols() ); + size_t nCount = 0; + for (size_t i = 0; i < aSymbols.size(); ++i) { - const SmSym * pSymbol = rManager.GetSymbolByPos( i ); + const SmSym * pSymbol = aSymbols[ i ]; if (pSymbol && !pSymbol->IsPredefined () ) { aVector.push_back ( pSymbol ); @@ -903,12 +904,12 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu Sequence < SymbolDescriptor > aSequence ( nCount ); SymbolDescriptor * pDescriptor = aSequence.getArray(); - vector <const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); + vector < const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); for(; aIter != aEnd; pDescriptor++, aIter++) { pDescriptor->sName = (*aIter)->GetName(); pDescriptor->sExportName = (*aIter)->GetExportName(); - pDescriptor->sSymbolSet = (*aIter)->GetSetName(); + pDescriptor->sSymbolSet = (*aIter)->GetSymbolSetName(); pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter()); Font rFont = (*aIter)->GetFace(); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index e935958102a7..886d409931b2 100644..100755 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -107,7 +107,7 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell): const Fraction aFraction (1,1); SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction)); - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); SetTotalSize(); @@ -145,7 +145,7 @@ void SmGraphicWindow::ApplyColorConfigValues( const svtools::ColorConfig &rColor void SmGraphicWindow::DataChanged( const DataChangedEvent& rEvt ) { - ApplyColorConfigValues( SM_MOD1()->GetColorConfig() ); + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); ScrollableWindow::DataChanged( rEvt ); } @@ -270,7 +270,7 @@ void SmGraphicWindow::SetCursor(const Rectangle &rRect) // The old cursor will be removed, and the new one will be shown if // that is activated in the ConfigItem { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); if (IsCursorVisible()) ShowCursor(FALSE); // clean up remainings of old cursor @@ -324,7 +324,7 @@ void SmGraphicWindow::Paint(const Rectangle&) nCol++; const SmNode *pFound = SetCursorPos(nRow, nCol); - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); if (pFound && pp->GetConfig()->IsShowFormulaCursor()) ShowCursor(TRUE); } @@ -1163,7 +1163,7 @@ void SmViewShell::Impl_Print( USHORT SmViewShell::Print(SfxProgress & /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog * /*pPrintDialog*/) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Print" ); - DBG_ASSERT( 0, "SmViewShell::Print: no longer usewd with new UI print dialog. Should be removed!!" ); + DBG_ASSERT( 0, "SmViewShell::Print: no longer used with new UI print dialog. Should be removed!!" ); return 0; } @@ -1191,7 +1191,7 @@ USHORT SmViewShell::SetPrinter(SfxPrinter *pNewPrinter, USHORT nDiffFlags, bool if ((nDiffFlags & SFX_PRINTER_OPTIONS) == SFX_PRINTER_OPTIONS) { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); pp->GetConfig()->ItemSetToConfig(pNewPrinter->GetOptions()); } return 0; @@ -1379,7 +1379,7 @@ void SmViewShell::Execute(SfxRequest& rReq) { case SID_FORMULACURSOR: { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem *pItem; @@ -1681,11 +1681,11 @@ void SmViewShell::Execute(SfxRequest& rReq) SmDocShell *pDoc = GetDoc(); OutputDevice *pDev = pDoc->GetPrinter(); if (!pDev || pDev->GetDevFontCount() == 0) - pDev = &SM_MOD1()->GetDefaultVirtualDev(); + pDev = &SM_MOD()->GetDefaultVirtualDev(); DBG_ASSERT (pDev, "device for font list missing" ); - SmModule *pp = SM_MOD1(); - SmSymbolDialog( NULL, pDev, pp->GetSymSetManager(), *this ).Execute(); + SmModule *pp = SM_MOD(); + SmSymbolDialog( NULL, pDev, pp->GetSymbolManager(), *this ).Execute(); } break; } @@ -1760,7 +1760,7 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_FORMULACURSOR: { - SmModule *pp = SM_MOD1(); + SmModule *pp = SM_MOD(); rSet.Put(SfxBoolItem(nWh, pp->GetConfig()->IsShowFormulaCursor())); } break; diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 3adc03dc13a5..a206392aad3b 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -717,7 +717,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr --------------------------------------------------------------------*/ #define FN_LINE_NUMBERING_DLG (FN_EXTRA + 2 ) /* Zeilennumerierung */ -#define FN_THESAURUS_DLG (FN_EXTRA + 3 ) /* Thesaurus */ #define FN_HYPHENATE_OPT_DLG (FN_EXTRA + 5 ) /* Silbentrennung */ #define FN_ADD_UNKNOWN (FN_EXTRA + 6 ) /* Woerter lernen */ #define FN_DICTIONARY_DLG (FN_EXTRA + 8 ) /* Woerterbuecher */ diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index bcf511aa2a5b..fe77e94627d7 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -27,6 +27,8 @@ #ifndef _CRSRSH_HXX #define _CRSRSH_HXX +#include <com/sun/star/i18n/WordType.hpp> + #include <tools/string.hxx> #include <tools/link.hxx> #include <tools/rtti.hxx> @@ -748,9 +750,9 @@ public: BOOL SelectWord( const Point* pPt = 0 ); // Position vom akt. Cursor erfragen - BOOL IsStartWord()const; - BOOL IsEndWord() const; - BOOL IsInWord() const; + BOOL IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES )const; + BOOL IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + BOOL IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; BOOL IsStartSentence() const; BOOL IsEndSentence() const; BOOL IsSttPara() const; diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 8d2c1a81de49..f247422c089d 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -201,6 +201,7 @@ public: // change text to Upper/Lower/Hiragana/Katagana/... void TransliterateText( sal_uInt32 nType ); + void TransliterateText( const String& rModuleName ); // count words in current selection void CountWords( SwDocStat& rStat ) const; diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 6e26a6a3bfcb..d33c745524c1 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -26,7 +26,9 @@ ************************************************************************/ #ifndef _SWCRSR_HXX #define _SWCRSR_HXX + #include <com/sun/star/i18n/WordType.hpp> + #include <pam.hxx> #include <tblsel.hxx> #include <cshtyp.hxx> @@ -129,10 +131,10 @@ public: const SfxItemSet* rReplSet = 0 ); // UI versions - BOOL IsStartWord() const; - BOOL IsEndWord() const; + BOOL IsStartWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + BOOL IsEndWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + BOOL IsInWord( sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; BOOL IsStartEndSentence( bool bEnd ) const; - BOOL IsInWord() const; BOOL GoStartWord(); BOOL GoEndWord(); BOOL GoNextWord(); diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index f0036e7abf35..8d37888ea789 100644..100755 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -41,7 +41,7 @@ class ViewShell; class SwDocShell; namespace svtools{ class ColorConfig;} -#define VIEWOPT_1_IDLE 0x00000001L +//#define VIEWOPT_1_IDLE 0x00000001L no longer used, see new member 'bIdle' #define VIEWOPT_1_TAB 0x00000002L #define VIEWOPT_1_BLANK 0x00000004L #define VIEWOPT_1_HARDBLANK 0x00000008L @@ -164,6 +164,7 @@ protected: BOOL bBookview : 1; // view mode for page preview BOOL mbViewLayoutBookMode : 1; // book view mode for edit view sal_Bool bShowPlaceHolderFields : 1; //only used in printing! + mutable bool bIdle; // Maszstab USHORT nZoom; // Angaben in Prozent @@ -202,9 +203,14 @@ public: ----------------------------------------------------------------------------*/ inline BOOL IsIdle() const - { return nCoreOptions & VIEWOPT_1_IDLE ? TRUE : FALSE; } - inline void SetIdle( BOOL b ) - { (b != 0) ? (nCoreOptions |= VIEWOPT_1_IDLE ) : ( nCoreOptions &= ~VIEWOPT_1_IDLE); } + { return bIdle; } + + // logically this is a const function since it does not modify the viewoptions + // but only effects idle formatting. Of course that member is already implement + // in the wrong place here... Also currently there are many const modifying casts in the code + // just to call this function on otherwise const objects. Thus declaring it as const now. + inline void SetIdle( BOOL b ) const + { bIdle = b; } inline BOOL IsTab(BOOL bHard = FALSE) const { return !bReadonly && (nCoreOptions & VIEWOPT_1_TAB) && diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 012ebbd5e68c..e264aec28c28 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1485,6 +1485,24 @@ interface BaseText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TITLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TOGGLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecTransliteration; @@ -1585,6 +1603,12 @@ interface BaseText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents ] + SID_THES + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents + ] } //ende interface text diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index b45e4a305328..ee5fc431e165 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -398,7 +398,7 @@ interface BaseTextEditView ExecMethod = Execute ; StateMethod = GetState ; ] - FN_THESAURUS_DLG // status(final|play) + SID_THESAURUS // status(final|play) [ ExecMethod = ExecLingu ; StateMethod = GetState ; diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi index 441beec686c6..349e17b9d985 100755 --- a/sw/sdi/annotsh.sdi +++ b/sw/sdi/annotsh.sdi @@ -31,7 +31,7 @@ interface Annotation : _Annotation ] { - FN_THESAURUS_DLG // api: + SID_THESAURUS // api: [ ExecMethod = ExecLingu ; StateMethod = GetLinguState ; @@ -178,6 +178,27 @@ interface Annotation : _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_TRANSLITERATE_TITLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_TRANSLITERATE_TOGGLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_UPPER [ ExecMethod = ExecTransliteration; @@ -344,6 +365,13 @@ interface Annotation : _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_THES + [ + ExecMethod = ExecLingu ; + StateMethod = GetLinguState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents + ] + } shell SwAnnotationShell diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 6887346ee012..d98d368a9460 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -424,7 +424,7 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_THESAURUS_DLG // api: + SID_THESAURUS // api: [ ExecMethod = ExecDrawLingu ; StateMethod = GetState ; @@ -478,6 +478,24 @@ interface TextDrawText [ StateMethod = StateInsert ; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TITLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TRANSLITERATE_TOGGLE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_TRANSLITERATE_UPPER [ ExecMethod = ExecTransliteration; @@ -514,6 +532,7 @@ interface TextDrawText StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_LANGUAGE_STATUS [ ExecMethod = Execute; @@ -521,6 +540,13 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents ] + SID_THES + [ + ExecMethod = Execute; + StateMethod = GetState; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; // e.g. disable for read-only documents + ] + FN_FORMAT_FOOTNOTE_DLG // status() [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index aede24688e1e..c27ac20b0013 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -8319,31 +8319,6 @@ SfxVoidItem TextWrap FN_DRAW_WRAP_DLG ] //-------------------------------------------------------------------------- -SfxVoidItem ThesaurusDialog FN_THESAURUS_DLG -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_OPTIONS; -] - -//-------------------------------------------------------------------------- SfxVoidItem ToggleAnchorType FN_TOOL_ANKER () [ diff --git a/sw/sdi/swslots.src b/sw/sdi/swslots.src deleted file mode 100644 index 030fdee2a157..000000000000 --- a/sw/sdi/swslots.src +++ /dev/null @@ -1,1488 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "cmdid.h" -#include "svx/svxids.hrc" -#include "globals.hrc" -SfxSlotInfo FN_ABSTRACT_NEWDOC -{ - Slotname [ en-US ] = "Document From Abstract"; -}; -SfxSlotInfo FN_ABSTRACT_STARIMPRESS -{ - Slotname [ en-US ] = "Presentation from Abstract"; -}; -SfxSlotInfo FN_ADD_UNKNOWN -{ - Slotname [ en-US ] = "Add Unknown Words"; -}; -SfxSlotInfo FN_AUTO_CORRECT -{ - Slotname [ en-US ] = "AutoCorrect"; -}; -SfxSlotInfo FN_AUTOFORMAT_APPLY -{ - Slotname [ en-US ] = "Apply AutoFormat Options"; -}; -SfxSlotInfo FN_AUTOFORMAT_AUTO -{ - Slotname [ en-US ] = "AutoFormat While Typing"; -}; -SfxSlotInfo FN_AUTOFORMAT_REDLINE_APPLY -{ - Slotname [ en-US ] = "Apply AutoFormat Options and confirm Changes"; -}; -SfxSlotInfo FN_BACKSPACE -{ - Slotname [ en-US ] = "Backspace"; -}; -SfxSlotInfo FN_CALC_TABLE -{ - Slotname [ en-US ] = "Calculate Table"; -}; -SfxSlotInfo FN_CALCULATE -{ - Slotname [ en-US ] = "Calculate Selection"; -}; -SfxSlotInfo FN_CHANGE_DBFIELD -{ - Slotname [ en-US ] = "Change Database"; -}; -SfxSlotInfo FN_CHANGE_PAGENUM -{ - Slotname [ en-US ] = "Page Number"; -}; -SfxSlotInfo FN_CHAR_LEFT -{ - Slotname [ en-US ] = "To Character Left"; -}; -SfxSlotInfo FN_CHAR_LEFT_SEL -{ - Slotname [ en-US ] = "Select Character Left"; -}; -SfxSlotInfo FN_CHAR_RIGHT -{ - Slotname [ en-US ] = "Go Right"; -}; -SfxSlotInfo FN_CHAR_RIGHT_SEL -{ - Slotname [ en-US ] = "Select Character Right"; -}; -SfxSlotInfo FN_CNTNT_TO_NEXT_FRAME -{ - Slotname [ en-US ] = "To Next Frame"; -}; -SfxSlotInfo FN_CONVERT_TEXT_TABLE -{ - Slotname [ en-US ] = "Convert Table/Text"; -}; -SfxSlotInfo FN_DEC_INDENT_OFFSET -{ - Slotname [ en-US ] = "Decrement Indent Value"; -}; -SfxSlotInfo FN_DELETE_BACK_LINE -{ - Slotname [ en-US ] = "Delete to Start of Line"; -}; -SfxSlotInfo FN_DELETE_BACK_PARA -{ - Slotname [ en-US ] = "Delete to Start of Paragraph"; -}; -SfxSlotInfo FN_DELETE_BACK_SENT -{ - Slotname [ en-US ] = "Delete to Start of Sentence"; -}; -SfxSlotInfo FN_DELETE_BACK_WORD -{ - Slotname [ en-US ] = "Delete to Start of Word"; -}; -SfxSlotInfo FN_DELETE_LINE -{ - Slotname [ en-US ] = "Delete to End of Line"; -}; -SfxSlotInfo FN_DELETE_PARA -{ - Slotname [ en-US ] = "Delete to End of Paragraph"; -}; -SfxSlotInfo FN_DELETE_SENT -{ - Slotname [ en-US ] = "Delete to End of Sentence"; -}; -SfxSlotInfo FN_DELETE_WHOLE_LINE -{ - Slotname [ en-US ] = "Delete Row"; -}; -SfxSlotInfo FN_DELETE_WORD -{ - Slotname [ en-US ] = "Delete to End of Word"; -}; -SfxSlotInfo FN_DRAW_WRAP_DLG -{ - Slotname [ en-US ] = "Text Wrap"; -}; -SfxSlotInfo FN_DRAWTEXT_ATTR_DLG -{ - Slotname [ en-US ] = "Text Attributes"; -}; -SfxSlotInfo FN_EDIT_FIELD -{ - Slotname [ en-US ] = "Fields"; -}; -SfxSlotInfo FN_EDIT_FOOTNOTE -{ - Slotname [ en-US ] = "Footnote"; -}; -SfxSlotInfo FN_EDIT_FORMULA -{ - Slotname [ en-US ] = "Formula Bar"; -}; -SfxSlotInfo FN_EDIT_IDX_ENTRY_DLG -{ - Slotname [ en-US ] = "Index Entry"; -}; -SfxSlotInfo FN_EDIT_LINK_DLG -{ - Slotname [ en-US ] = "Links"; -}; -SfxSlotInfo FN_EDIT_REGION -{ - Slotname [ en-US ] = "Sections"; -}; -SfxSlotInfo FN_END_DOC_DIRECT -{ - Slotname [ en-US ] = "Directly to Document End"; -}; -SfxSlotInfo FN_END_OF_COLUMN -{ - Slotname [ en-US ] = "To Column End"; -}; -SfxSlotInfo FN_END_OF_DOCUMENT -{ - Slotname [ en-US ] = "To Document End"; -}; -SfxSlotInfo FN_END_OF_DOCUMENT_SEL -{ - Slotname [ en-US ] = "Select to Document End"; -}; -SfxSlotInfo FN_END_OF_LINE -{ - Slotname [ en-US ] = "To End of Line"; -}; -SfxSlotInfo FN_END_OF_LINE_SEL -{ - Slotname [ en-US ] = "Select to End of Line"; -}; -SfxSlotInfo FN_END_OF_NEXT_COLUMN -{ - Slotname [ en-US ] = "To End of Next Column"; -}; -SfxSlotInfo FN_END_OF_NEXT_PAGE -{ - Slotname [ en-US ] = "To End of Next Page"; -}; -SfxSlotInfo FN_END_OF_NEXT_PAGE_SEL -{ - Slotname [ en-US ] = "Select to End of Next Page"; -}; -SfxSlotInfo FN_END_OF_PAGE -{ - Slotname [ en-US ] = "To Page End"; -}; -SfxSlotInfo FN_END_OF_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Page End"; -}; -SfxSlotInfo FN_END_OF_PARA -{ - Slotname [ en-US ] = "To Paragraph End"; -}; -SfxSlotInfo FN_END_OF_PARA_SEL -{ - Slotname [ en-US ] = "Select to Paragraph End"; -}; -SfxSlotInfo FN_END_OF_PREV_COLUMN -{ - Slotname [ en-US ] = "To Previous Column"; -}; -SfxSlotInfo FN_END_OF_PREV_PAGE -{ - Slotname [ en-US ] = "To End of Previous Page"; -}; -SfxSlotInfo FN_END_OF_PREV_PAGE_SEL -{ - Slotname [ en-US ] = "Select to End of Previous Page"; -}; -SfxSlotInfo FN_END_TABLE -{ - Slotname [ en-US ] = "To Table End"; -}; -SfxSlotInfo FN_ENVELOP -{ - Slotname [ en-US ] = "Insert Envelope"; -}; -SfxSlotInfo FN_ESCAPE -{ - Slotname [ en-US ] = "Cancel"; -}; -SfxSlotInfo FN_EXECUTE_MACROFIELD -{ - Slotname [ en-US ] = "Run Macro Field"; -}; -SfxSlotInfo FN_EXPAND_GLOSSARY -{ - Slotname [ en-US ] = "Run AutoText Entry"; -}; -SfxSlotInfo FN_FLIP_HORZ_GRAFIC -{ - Slotname [ en-US ] = "Flip Vertically"; -}; -SfxSlotInfo FN_FLIP_VERT_GRAFIC -{ - Slotname [ en-US ] = "Flip Horizontally"; -}; -SfxSlotInfo FN_FOOTNOTE_TO_ANCHOR -{ - Slotname [ en-US ] = "To Footnote Anchor"; -}; -SfxSlotInfo FN_FORMAT_BACKGROUND_DLG -{ - Slotname [ en-US ] = "Background"; -}; -SfxSlotInfo FN_FORMAT_BORDER_DLG -{ - Slotname [ en-US ] = "Borders"; -}; -SfxSlotInfo FN_FORMAT_DROPCAPS -{ - Slotname [ en-US ] = "Drop Caps"; -}; -SfxSlotInfo FN_FORMAT_FOOTNOTE_DLG -{ - Slotname [ en-US ] = "Footnotes"; -}; -SfxSlotInfo FN_FORMAT_FRAME_DLG -{ - Slotname [ en-US ] = "Frame Properties"; -}; -SfxSlotInfo FN_FORMAT_GRAFIC_DLG -{ - Slotname [ en-US ] = "Edit Graphics"; -}; -SfxSlotInfo FN_FORMAT_PAGE_COLUMN_DLG -{ - Slotname [ en-US ] = "Page Columns"; -}; -SfxSlotInfo FN_FORMAT_PAGE_DLG -{ - Slotname [ en-US ] = "Page Settings"; -}; -SfxSlotInfo FN_FORMAT_RESET -{ - Slotname [ en-US ] = "Reset Font Attributes"; -}; -SfxSlotInfo FN_FORMAT_TABLE_DLG -{ - Slotname [ en-US ] = "Edit Table"; -}; -SfxSlotInfo FN_FRAME_ALIGN_HORZ_CENTER -{ - Slotname [ en-US ] = "Center Horizontal"; -}; -SfxSlotInfo FN_FRAME_ALIGN_HORZ_LEFT -{ - Slotname [ en-US ] = "Align Left"; -}; -SfxSlotInfo FN_FRAME_ALIGN_HORZ_RIGHT -{ - Slotname [ en-US ] = "Align Right"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_BOTTOM -{ - Slotname [ en-US ] = "Align Bottom"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CENTER -{ - Slotname [ en-US ] = "Align Vertical Center"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CHAR_BOTTOM -{ - Slotname [ en-US ] = "Align to Bottom of Character"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CHAR_CENTER -{ - Slotname [ en-US ] = "Align to Vertical Center of Character"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_CHAR_TOP -{ - Slotname [ en-US ] = "Align to Top of Character"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_ROW_BOTTOM -{ - Slotname [ en-US ] = "Align to Bottom of Line"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_ROW_CENTER -{ - Slotname [ en-US ] = "Align to Vertical Center of Line"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_ROW_TOP -{ - Slotname [ en-US ] = "Align to Top of Line"; -}; -SfxSlotInfo FN_FRAME_ALIGN_VERT_TOP -{ - Slotname [ en-US ] = "Align Top"; -}; -SfxSlotInfo FN_FRAME_CHAIN -{ - Slotname [ en-US ] = "Link Frames"; -}; -SfxSlotInfo FN_FRAME_DOWN -{ - Slotname [ en-US ] = "Send Backward"; -}; -SfxSlotInfo FN_FRAME_MIRROR_ON_EVEN_PAGES -{ - Slotname [ en-US ] = "Mirror Object on Even Pages"; -}; -SfxSlotInfo FN_FRAME_NOWRAP -{ - Slotname [ en-US ] = "Wrap Off"; -}; -SfxSlotInfo FN_FRAME_TO_ANCHOR -{ - Slotname [ en-US ] = "Set Cursor To Anchor"; -}; -SfxSlotInfo FN_FRAME_UNCHAIN -{ - Slotname [ en-US ] = "Unlink Frames"; -}; -SfxSlotInfo FN_FRAME_UP -{ - Slotname [ en-US ] = "Bring Forward"; -}; -SfxSlotInfo FN_FRAME_WRAP -{ - Slotname [ en-US ] = "Wrap On"; -}; -SfxSlotInfo FN_FRAME_WRAP_CONTOUR -{ - Slotname [ en-US ] = "Wrap Contour On"; -}; -SfxSlotInfo FN_FRAME_WRAP_IDEAL -{ - Slotname [ en-US ] = "Wrap Optimal"; -}; -SfxSlotInfo FN_FRAME_WRAP_LEFT -{ - Slotname [ en-US ] = "Wrap Left"; -}; -SfxSlotInfo FN_FRAME_WRAP_RIGHT -{ - Slotname [ en-US ] = "Wrap Right"; -}; -SfxSlotInfo FN_FRAME_WRAPTHRU -{ - Slotname [ en-US ] = "Wrap Through"; -}; -SfxSlotInfo FN_FRAME_WRAPTHRU_TRANSP -{ - Slotname [ en-US ] = "Wrap Transparent"; -}; -SfxSlotInfo FN_GLOSSARY_DLG -{ - Slotname [ en-US ] = "Edit AutoText"; -}; -SfxSlotInfo FN_GOTO_NEXT_INPUTFLD -{ - Slotname [ en-US ] = "To Next Input Field"; -}; -SfxSlotInfo FN_GOTO_NEXT_MARK -{ - Slotname [ en-US ] = "To Next Placeholder"; -}; -SfxSlotInfo FN_GOTO_NEXT_OBJ -{ - Slotname [ en-US ] = "To Next Object"; -}; -SfxSlotInfo FN_GOTO_NEXT_REGION -{ - Slotname [ en-US ] = "To Next Section"; -}; -SfxSlotInfo FN_GOTO_PREV_INPUTFLD -{ - Slotname [ en-US ] = "To Previous Input Field"; -}; -SfxSlotInfo FN_GOTO_PREV_MARK -{ - Slotname [ en-US ] = "To Previous Placeholder"; -}; -SfxSlotInfo FN_GOTO_PREV_OBJ -{ - Slotname [ en-US ] = "To Previous Object"; -}; -SfxSlotInfo FN_GOTO_PREV_REGION -{ - Slotname [ en-US ] = "To Previous Section"; -}; -SfxSlotInfo FN_GOTO_REFERENCE -{ - Slotname [ en-US ] = "To Reference"; -}; -SfxSlotInfo FN_GRAPHIC_MIRROR_ON_EVEN_PAGES -{ - Slotname [ en-US ] = "Flip Graphics on Even Pages"; -}; -SfxSlotInfo FN_GROW_FONT_SIZE -{ - Slotname [ en-US ] = "Increase Font"; -}; -SfxSlotInfo FN_HSCROLLBAR -{ - Slotname [ en-US ] = "Scroll Horizontal"; -}; -SfxSlotInfo FN_HYPHENATE_OPT_DLG -{ - Slotname [ en-US ] = "Hyphenation"; -}; -SfxSlotInfo FN_IDX_MARK_TO_IDX -{ - Slotname [ en-US ] = "Index Mark to Index"; -}; -SfxSlotInfo FN_INC_INDENT_OFFSET -{ - Slotname [ en-US ] = "Increment Indent Value"; -}; -SfxSlotInfo FN_INSERT_BOOKMARK -{ - Slotname [ en-US ] = "Insert Bookmark"; -}; -SfxSlotInfo FN_INSERT_BREAK -{ - Slotname [ en-US ] = "Insert Paragraph"; -}; -SfxSlotInfo FN_INSERT_BREAK_DLG -{ - Slotname [ en-US ] = "Insert Manual Break"; -}; -SfxSlotInfo FN_INSERT_CAPTION -{ - Slotname [ en-US ] = "Insert Caption"; -}; -SfxSlotInfo FN_INSERT_COLUMN_BREAK -{ - Slotname [ en-US ] = "Insert Column Break"; -}; -SfxSlotInfo FN_INSERT_CTRL -{ - Slotname [ en-US ] = "Insert"; -}; -SfxSlotInfo FN_INSERT_ENDNOTE -{ - Slotname [ en-US ] = "Insert Endnote Directly"; -}; -SfxSlotInfo FN_INSERT_FIELD -{ - Slotname [ en-US ] = "Fields Dialog"; -}; -SfxSlotInfo FN_INSERT_FIELD_CTRL -{ - Slotname [ en-US ] = "Insert Fields"; -}; -SfxSlotInfo FN_INSERT_FLD_AUTHOR -{ - Slotname [ en-US ] = "Insert Author Field"; -}; -SfxSlotInfo FN_INSERT_FLD_DATE -{ - Slotname [ en-US ] = "Insert Date"; -}; -SfxSlotInfo FN_INSERT_FLD_PGCOUNT -{ - Slotname [ en-US ] = "Insert Page Count"; -}; -SfxSlotInfo FN_INSERT_FLD_PGNUMBER -{ - Slotname [ en-US ] = "Insert Page Number"; -}; -SfxSlotInfo FN_INSERT_FLD_TIME -{ - Slotname [ en-US ] = "Insert Time"; -}; -SfxSlotInfo FN_INSERT_FLD_TITLE -{ - Slotname [ en-US ] = "Insert Document Title"; -}; -SfxSlotInfo FN_INSERT_FLD_TOPIC -{ - Slotname [ en-US ] = "Insert Subject"; -}; -SfxSlotInfo FN_INSERT_FOOTNOTE -{ - Slotname [ en-US ] = "Insert Footnote Directly"; -}; -SfxSlotInfo FN_INSERT_FOOTNOTE_DLG -{ - Slotname [ en-US ] = "Insert Footnote"; -}; -SfxSlotInfo FN_INSERT_FRAME -{ - Slotname [ en-US ] = "Insert Frame"; -}; -SfxSlotInfo FN_INSERT_FRAME_INTERACT_NOCOL -{ - Slotname [ en-US ] = "Insert single-column frame manually"; -}; -SfxSlotInfo FN_INSERT_FRAME_INTERACT -{ - Slotname [ en-US ] = "Insert Frame Manually"; -}; -SfxSlotInfo FN_INSERT_HARD_SPACE -{ - Slotname [ en-US ] = "Insert Non-breaking Space"; -}; -SfxSlotInfo FN_INSERT_HARDHYPHEN -{ - Slotname [ en-US ] = "Insert Non-breaking Hyphen"; -}; -SfxSlotInfo FN_INSERT_HRULER -{ - Slotname [ en-US ] = "Insert Horizontal Ruler"; -}; -SfxSlotInfo FN_INSERT_HYPERLINK -{ - Slotname [ en-US ] = "Insert Hyperlink"; -}; -SfxSlotInfo FN_INSERT_IDX_ENTRY_DLG -{ - Slotname [ en-US ] = "Insert Index Marker"; -}; -SfxSlotInfo FN_INSERT_LINEBREAK -{ - Slotname [ en-US ] = "Insert Manual Row Break"; -}; -SfxSlotInfo FN_INSERT_OBJ_CTRL -{ - Slotname [ en-US ] = "Insert Object"; -}; -SfxSlotInfo FN_INSERT_OBJECT_DLG -{ - Slotname [ en-US ] = "Insert Other Objects"; -}; -SfxSlotInfo FN_INSERT_PAGEBREAK -{ - Slotname [ en-US ] = "Insert Manual Page Break"; -}; -SfxSlotInfo FN_INSERT_PAGEFOOTER -{ - Slotname [ en-US ] = "Insert Footer"; -}; -SfxSlotInfo FN_INSERT_PAGEHEADER -{ - Slotname [ en-US ] = "Insert Header"; -}; -SfxSlotInfo FN_INSERT_REF_FIELD -{ - Slotname [ en-US ] = "Insert Field Reference"; -}; -SfxSlotInfo FN_INSERT_REGION -{ - Slotname [ en-US ] = "Insert Section"; -}; -SfxSlotInfo FN_INSERT_SMA -{ - Slotname [ en-US ] = "Insert %PRODUCTNAME Math object"; -}; -SfxSlotInfo FN_INSERT_SOFT_HYPHEN -{ - Slotname [ en-US ] = "Insert Optional Hyphen"; -}; -SfxSlotInfo FN_INSERT_SYMBOL -{ - Slotname [ en-US ] = "Insert Special Character "; -}; -SfxSlotInfo FN_INSERT_TABLE -{ - Slotname [ en-US ] = "Insert Table"; -}; -SfxSlotInfo FN_JAVAEDIT -{ - Slotname [ en-US ] = "Insert Script"; -}; -SfxSlotInfo FN_LABEL -{ - Slotname [ en-US ] = "Insert Labels"; -}; -SfxSlotInfo FN_BUSINESS_CARD -{ - Slotname [ en-US ] = "Insert business cards"; -}; -SfxSlotInfo FN_LINE_DOWN -{ - Slotname [ en-US ] = "To Line Below"; -}; -SfxSlotInfo FN_LINE_DOWN_SEL -{ - Slotname [ en-US ] = "Select Down"; -}; -SfxSlotInfo FN_LINE_NUMBERING_DLG -{ - Slotname [ en-US ] = "Set Line Numbering"; -}; -SfxSlotInfo FN_LINE_UP -{ - Slotname [ en-US ] = "To Top Line"; -}; -SfxSlotInfo FN_LINE_UP_SEL -{ - Slotname [ en-US ] = "Select to Top Line"; -}; -SfxSlotInfo FN_NAVIGATION_PI_GOTO_PAGE -{ - Slotname [ en-US ] = "To Page"; -}; -SfxSlotInfo FN_NEW_GLOBAL_DOC -{ - Slotname [ en-US ] = "Create Master Document"; -}; -SfxSlotInfo FN_NEW_HTML_DOC -{ - Slotname [ en-US ] = "Create HTML Document"; -}; -SfxSlotInfo FN_NEXT_BOOKMARK -{ - Slotname [ en-US ] = "To Next Bookmark"; -}; -SfxSlotInfo FN_NEXT_FOOTNOTE -{ - Slotname [ en-US ] = "To Next Footnote"; -}; -SfxSlotInfo FN_NEXT_PARA -{ - Slotname [ en-US ] = "To Next Paragraph"; -}; -SfxSlotInfo FN_NEXT_SENT -{ - Slotname [ en-US ] = "To Next Sentence"; -}; -SfxSlotInfo FN_NEXT_SENT_SEL -{ - Slotname [ en-US ] = "Select to Next Sentence"; -}; -SfxSlotInfo FN_NEXT_TABLE -{ - Slotname [ en-US ] = "To Next Table"; -}; -SfxSlotInfo FN_NEXT_TBLFML -{ - Slotname [ en-US ] = "Go to next table formula"; -}; -SfxSlotInfo FN_NEXT_TBLFML_ERR -{ - Slotname [ en-US ] = "Go to next faulty table formula"; -}; -SfxSlotInfo FN_NEXT_TOXMARK -{ - Slotname [ en-US ] = "Go to Next Index Mark"; -}; -SfxSlotInfo FN_NEXT_WORD -{ - Slotname [ en-US ] = "To Word Right"; -}; -SfxSlotInfo FN_NEXT_WORD_SEL -{ - Slotname [ en-US ] = "Select to Word Right"; -}; -SfxSlotInfo FN_NUM_BULLET_DOWN -{ - Slotname [ en-US ] = "Down One Level"; -}; -SfxSlotInfo FN_NUM_BULLET_MOVEDOWN -{ - Slotname [ en-US ] = "Move Down"; -}; -SfxSlotInfo FN_NUM_BULLET_MOVEUP -{ - Slotname [ en-US ] = "Move Up"; -}; -SfxSlotInfo FN_NUM_BULLET_NEXT -{ - Slotname [ en-US ] = "To Next Paragraph in Level"; -}; -SfxSlotInfo FN_NUM_BULLET_NONUM -{ - Slotname [ en-US ] = "Insert Unnumbered Entry"; -}; -SfxSlotInfo FN_NUM_BULLET_OFF -{ - Slotname [ en-US ] = "Numbering Off"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_DOWN -{ - Slotname [ en-US ] = "Move Down with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_MOVEDOWN -{ - Slotname [ en-US ] = "Move Down with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_MOVEUP -{ - Slotname [ en-US ] = "Move Up with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_OUTLINE_UP -{ - Slotname [ en-US ] = "Move Up with Subpoints"; -}; -SfxSlotInfo FN_NUM_BULLET_PREV -{ - Slotname [ en-US ] = "To Previous Paragraph in Level"; -}; -SfxSlotInfo FN_NUM_BULLET_UP -{ - Slotname [ en-US ] = "Up One Level"; -}; -SfxSlotInfo FN_NUM_FORMAT_TABLE_DLG -{ - Slotname [ en-US ] = "Edit Number Format"; -}; -SfxSlotInfo FN_NUM_OR_NONUM -{ - Slotname [ en-US ] = "Numbering On/Off"; -}; -SfxSlotInfo FN_NUMBER_BULLETS -{ - Slotname [ en-US ] = "Edit Numbering"; -}; -SfxSlotInfo FN_NUMBER_CURRENCY -{ - Slotname [ en-US ] = "Number Format: Currency"; -}; -SfxSlotInfo FN_NUMBER_DATE -{ - Slotname [ en-US ] = "Number Format : Date"; -}; -SfxSlotInfo FN_NUMBER_NEWSTART -{ - Slotname [ en-US ] = "Restart Numbering"; -}; -SfxSlotInfo FN_NUMBER_PERCENT -{ - Slotname [ en-US ] = "Number Format: Percent"; -}; -SfxSlotInfo FN_NUMBER_SCIENTIFIC -{ - Slotname [ en-US ] = "Number Format: Exponential"; -}; -SfxSlotInfo FN_NUMBER_STANDARD -{ - Slotname [ en-US ] = "Number Format: Standard"; -}; -SfxSlotInfo FN_NUMBER_TIME -{ - Slotname [ en-US ] = "Number Format: Time"; -}; -SfxSlotInfo FN_NUMBER_TWODEC -{ - Slotname [ en-US ] = "Number Format: Decimal"; -}; -SfxSlotInfo FN_NUMBERING_OUTLINE_DLG -{ - Slotname [ en-US ] = "Outline Numbering"; -}; -SfxSlotInfo FN_OPTIMIZE_TABLE -{ - Slotname [ en-US ] = "Optimize"; -}; -SfxSlotInfo FN_OUTLINE_TO_CLIPBOARD -{ - Slotname [ en-US ] = "Outline to Clipboard"; -}; -SfxSlotInfo FN_OUTLINE_TO_IMPRESS -{ - Slotname [ en-US ] = "Outline to Presentation"; -}; -SfxSlotInfo FN_PAGE_STYLE_SET_COLS -{ - Slotname [ en-US ] = "Page Style: Columns"; -}; -SfxSlotInfo FN_PAGEDOWN -{ - Slotname [ en-US ] = "Next Page"; -}; -SfxSlotInfo FN_PAGEDOWN_SEL -{ - Slotname [ en-US ] = "Select to Next Page"; -}; -SfxSlotInfo FN_PAGEUP -{ - Slotname [ en-US ] = "Previous Page"; -}; -SfxSlotInfo FN_PAGEUP_SEL -{ - Slotname [ en-US ] = "Select to Previous Page"; -}; -SfxSlotInfo FN_PASTESPECIAL -{ - Slotname [ en-US ] = "Paste Special"; -}; -SfxSlotInfo FN_PASTEUNFORMATTED -{ - Slotname [ en-US ] = "Paste Unformatted Text"; -}; -SfxSlotInfo FN_POSTIT -{ - Slotname [ en-US ] = "Insert Note"; -}; -SfxSlotInfo FN_PREV_BOOKMARK -{ - Slotname [ en-US ] = "To Previous Bookmark"; -}; -SfxSlotInfo FN_PREV_FOOTNOTE -{ - Slotname [ en-US ] = "To Previous Footnote"; -}; -SfxSlotInfo FN_PREV_PARA -{ - Slotname [ en-US ] = "To Previous Paragraph"; -}; -SfxSlotInfo FN_PREV_SENT -{ - Slotname [ en-US ] = "To Previous Sentence"; -}; -SfxSlotInfo FN_PREV_SENT_SEL -{ - Slotname [ en-US ] = "Select to Previous Sentence"; -}; -SfxSlotInfo FN_PREV_TABLE -{ - Slotname [ en-US ] = "To Previous Table"; -}; -SfxSlotInfo FN_PREV_TBLFML -{ - Slotname [ en-US ] = "Go to previous table formula"; -}; -SfxSlotInfo FN_PREV_TBLFML_ERR -{ - Slotname [ en-US ] = "Go to previous faulty table formula"; -}; -SfxSlotInfo FN_PREV_TOXMARK -{ - Slotname [ en-US ] = "Go to Previous Index Mark"; -}; -SfxSlotInfo FN_PREV_WORD -{ - Slotname [ en-US ] = "To Word Left"; -}; -SfxSlotInfo FN_PREV_WORD_SEL -{ - Slotname [ en-US ] = "Select to Begin of Word"; -}; -SfxSlotInfo FN_PREVIEW_ZOOM -{ - Slotname [ en-US ] = "Preview Zoom"; -}; -SfxSlotInfo FN_PRINT_LAYOUT -{ - Slotname [ en-US ] = "Print Layout On/Off"; -}; -SfxSlotInfo FN_PRINT_PAGEPREVIEW -{ - Slotname [ en-US ] = "Print document"; -}; -SfxSlotInfo FN_MAILMERGE_WIZARD -{ - SlotName[ en-US ] = "Mail Merge Wizard"; -}; -SfxSlotInfo FN_QRY_MERGE -{ - Slotname [ en-US ] = "Prepare Mail Merge"; -}; -SfxSlotInfo FN_REDLINE_ACCEPT -{ - Slotname [ en-US ] = "Accept or Reject Changes"; -}; -SfxSlotInfo FN_REDLINE_COMMENT -{ - Slotname [ en-US ] = "Insert Comment"; -}; -SfxSlotInfo FN_REDLINE_ON -{ - Slotname [ en-US ] = "Switch on Review"; -}; -SfxSlotInfo FN_REDLINE_PROTECT -{ - Slotname [ en-US ] = "Protect Record of Changes"; -}; -SfxSlotInfo FN_REDLINE_SHOW -{ - Slotname [ en-US ] = "Highlight Changes"; -}; -SfxSlotInfo FN_REFRESH_VIEW -{ - Slotname [ en-US ] = "Restore View"; -}; -SfxSlotInfo FN_REPAGINATE -{ - Slotname [ en-US ] = "Repaginate"; -}; -SfxSlotInfo FN_REPEAT_SEARCH -{ - Slotname [ en-US ] = "Repeat Search"; -}; -SfxSlotInfo FN_RULER -{ - Slotname [ en-US ] = "Ruler On/Off"; -}; -SfxSlotInfo FN_SELECT_PARA -{ - Slotname [ en-US ] = "Select Paragraph"; -}; -SfxSlotInfo FN_SELECT_WORD -{ - Slotname [ en-US ] = "Select Word"; -}; -SfxSlotInfo FN_SET_ADD_MODE -{ - Slotname [ en-US ] = "MultiSelection On"; -}; -SfxSlotInfo FN_SET_EXT_MODE -{ - Slotname [ en-US ] = "Extended Selection On"; -}; -SfxSlotInfo FN_SET_PAGE_STYLE -{ - Slotname [ en-US ] = "Apply Page Style"; -}; -SfxSlotInfo FN_SET_SUB_SCRIPT -{ - Slotname [ en-US ] = "Subscript"; -}; -SfxSlotInfo FN_SET_SUPER_SCRIPT -{ - Slotname [ en-US ] = "Superscript"; -}; -SfxSlotInfo FN_SHADOWCURSOR -{ - Slotname [ en-US ] = "Direct Cursor On/Off"; -}; -SfxSlotInfo FN_SHIFT_BACKSPACE -{ - Slotname [ en-US ] = "Backspace"; -}; -SfxSlotInfo FN_SHOW_MULTIPLE_PAGES -{ - Slotname [ en-US ] = "Page Preview: Multiple Pages"; -}; -SfxSlotInfo FN_SHOW_TWO_PAGES -{ - Slotname [ en-US ] = "Page Preview: Two Pages"; -}; -SfxSlotInfo FN_SHOW_BOOKVIEW -{ - SlotName[ en-US ] = "Book Preview"; -}; -SfxSlotInfo FN_SHRINK_FONT_SIZE -{ - Slotname [ en-US ] = "Reduce Font"; -}; -SfxSlotInfo FN_SORTING_DLG -{ - Slotname [ en-US ] = "Sort"; -}; -SfxSlotInfo FN_START_DOC_DIRECT -{ - Slotname [ en-US ] = "Directly to Document Begin"; -}; -SfxSlotInfo FN_START_OF_COLUMN -{ - Slotname [ en-US ] = "To Column Begin"; -}; -SfxSlotInfo FN_START_OF_DOCUMENT -{ - Slotname [ en-US ] = "To Document Begin"; -}; -SfxSlotInfo FN_START_OF_DOCUMENT_SEL -{ - Slotname [ en-US ] = "Select to Document Begin"; -}; -SfxSlotInfo FN_START_OF_LINE -{ - Slotname [ en-US ] = "To Line Begin"; -}; -SfxSlotInfo FN_START_OF_LINE_SEL -{ - Slotname [ en-US ] = "Select to Begin of Line"; -}; -SfxSlotInfo FN_START_OF_NEXT_COLUMN -{ - Slotname [ en-US ] = "To Begin of Next Column"; -}; -SfxSlotInfo FN_START_OF_NEXT_PAGE -{ - Slotname [ en-US ] = "To Begin of Next Page"; -}; -SfxSlotInfo FN_START_OF_NEXT_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Begin of Next Page"; -}; -SfxSlotInfo FN_START_OF_PAGE -{ - Slotname [ en-US ] = "To Page Begin"; -}; -SfxSlotInfo FN_START_OF_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Page Begin"; -}; -SfxSlotInfo FN_START_OF_PARA -{ - Slotname [ en-US ] = "To Paragraph Begin"; -}; -SfxSlotInfo FN_START_OF_PARA_SEL -{ - Slotname [ en-US ] = "Select to Paragraph Begin"; -}; -SfxSlotInfo FN_START_OF_PREV_COLUMN -{ - Slotname [ en-US ] = "To Begin of Previous Column"; -}; -SfxSlotInfo FN_START_OF_PREV_PAGE -{ - Slotname [ en-US ] = "To Begin of Previous Page"; -}; -SfxSlotInfo FN_START_OF_PREV_PAGE_SEL -{ - Slotname [ en-US ] = "Select to Begin of Previous Page"; -}; -SfxSlotInfo FN_START_TABLE -{ - Slotname [ en-US ] = "To Table Begin"; -}; -SfxSlotInfo FN_STAT_PAGE -{ - Slotname [ en-US ] = "Page Number"; -}; -SfxSlotInfo FN_STAT_SELMODE -{ - Slotname [ en-US ] = "Selection Mode"; -}; -SfxSlotInfo FN_STAT_TEMPLATE -{ - Slotname [ en-US ] = "Page Style"; -}; -SfxSlotInfo FN_TABLE_ADJUST_CELLS -{ - Slotname [ en-US ] = "Optimal Column Width"; -}; -SfxSlotInfo FN_TABLE_AUTOSUM -{ - Slotname [ en-US ] = "Sum"; -}; -SfxSlotInfo FN_TABLE_BALANCE_CELLS -{ - Slotname [ en-US ] = "Space Columns Equally"; -}; -SfxSlotInfo FN_TABLE_BALANCE_ROWS -{ - Slotname [ en-US ] = "Space Rows Equally "; -}; -SfxSlotInfo FN_TABLE_DELETE_COL -{ - Slotname [ en-US ] = "Delete Column"; -}; -SfxSlotInfo FN_TABLE_DELETE_ROW -{ - Slotname [ en-US ] = "Delete Row"; -}; -SfxSlotInfo FN_TABLE_INSERT_COL -{ - Slotname [ en-US ] = "Insert Column"; -}; -SfxSlotInfo FN_TABLE_INSERT_ROW -{ - Slotname [ en-US ] = "Insert Row"; -}; -SfxSlotInfo FN_TABLE_MERGE_CELLS -{ - Slotname [ en-US ] = "Merge Cells"; -}; -SfxSlotInfo FN_TABLE_MERGE_TABLE -{ - Slotname [ en-US ] = "Merge Table"; -}; -SfxSlotInfo FN_FORMAT_APPLY_HEAD1 -{ - Slotname [ en-US ] = "Apply Style Heading 1"; -}; -SfxSlotInfo FN_FORMAT_APPLY_HEAD2 -{ - Slotname [ en-US ] = "Apply Style Heading 2"; -}; -SfxSlotInfo FN_FORMAT_APPLY_HEAD3 -{ - Slotname [ en-US ] = "Apply Style Heading 3"; -}; -SfxSlotInfo FN_FORMAT_APPLY_DEFAULT -{ - Slotname [ en-US ] = "Apply Style Default"; -}; -SfxSlotInfo FN_FORMAT_APPLY_TEXTBODY -{ - Slotname [ en-US ] = "Apply Style Textbody"; -}; -SfxSlotInfo FN_TABLE_MODE_FIX -{ - Slotname [ en-US ] = "Table: Fixed"; -}; -SfxSlotInfo FN_TABLE_MODE_FIX_PROP -{ - Slotname [ en-US ] = "Table: Fixed, Proportional"; -}; -SfxSlotInfo FN_TABLE_MODE_VARIABLE -{ - Slotname [ en-US ] = "Table: Variable"; -}; -SfxSlotInfo FN_TABLE_OPTIMAL_HEIGHT -{ - Slotname [ en-US ] = "Optimal Row Height"; -}; -SfxSlotInfo FN_TABLE_SELECT_ALL -{ - Slotname [ en-US ] = "Select Table"; -}; -SfxSlotInfo FN_TABLE_SELECT_COL -{ - Slotname [ en-US ] = "Select Column"; -}; -SfxSlotInfo FN_TABLE_SELECT_ROW -{ - Slotname [ en-US ] = "Select Rows"; -}; -SfxSlotInfo FN_TABLE_SET_READ_ONLY_CELLS -{ - Slotname [ en-US ] = "Protect Cells"; -}; -SfxSlotInfo FN_TABLE_SET_ROW_HEIGHT -{ - Slotname [ en-US ] = "Row Height"; -}; -SfxSlotInfo FN_TABLE_SPLIT_CELLS -{ - Slotname [ en-US ] = "Split Cells"; -}; -SfxSlotInfo FN_TABLE_SPLIT_TABLE -{ - Slotname [ en-US ] = "Split Table"; -}; -SfxSlotInfo FN_TABLE_UNSET_READ_ONLY -{ - Slotname [ en-US ] = "Unprotect sheet"; -}; -SfxSlotInfo FN_TABLE_UNSET_READ_ONLY_CELLS -{ - Slotname [ en-US ] = "Unprotect cells"; -}; -SfxSlotInfo FN_TABLE_VERT_BOTTOM -{ - Slotname [ en-US ] = "Bottom"; -}; -SfxSlotInfo FN_TABLE_VERT_CENTER -{ - Slotname [ en-US ] = "Center ( vertical )"; -}; -SfxSlotInfo FN_TABLE_VERT_NONE -{ - Slotname [ en-US ] = "Top"; -}; -SfxSlotInfo FN_THESAURUS_DLG -{ - Slotname [ en-US ] = "Thesaurus"; -}; -SfxSlotInfo FN_TO_FOOTER -{ - Slotname [ en-US ] = "To Footer"; -}; -SfxSlotInfo FN_TO_HEADER -{ - Slotname [ en-US ] = "To Header"; -}; -SfxSlotInfo FN_TOOL_ANKER -{ - Slotname [ en-US ] = "Change Anchor"; -}; -SfxSlotInfo FN_TOOL_ANKER_AT_CHAR -{ - Slotname [ en-US ] = "Anchor to Character"; -}; -SfxSlotInfo FN_TOOL_ANKER_CHAR -{ - Slotname [ en-US ] = "Anchor as Character"; -}; -SfxSlotInfo FN_TOOL_ANKER_FRAME -{ - Slotname [ en-US ] = "Anchor To Frame"; -}; -SfxSlotInfo FN_TOOL_ANKER_PAGE -{ - Slotname [ en-US ] = "Anchor To Page"; -}; -SfxSlotInfo FN_TOOL_ANKER_PARAGRAPH -{ - Slotname [ en-US ] = "Anchor To Paragraph"; -}; -SfxSlotInfo FN_TOOL_GROUP -{ - Slotname [ en-US ] = "Group"; -}; -SfxSlotInfo FN_TOOL_HIERARCHIE -{ - Slotname [ en-US ] = "Change Position"; -}; -SfxSlotInfo FN_TOOL_UNGROUP -{ - Slotname [ en-US ] = "Ungroup"; -}; -SfxSlotInfo FN_UNDERLINE_DOUBLE -{ - Slotname [ en-US ] = "Double Underline "; -}; -SfxSlotInfo FN_UPDATE_ALL -{ - Slotname [ en-US ] = "Update All"; -}; -SfxSlotInfo FN_UPDATE_ALL_LINKS -{ - Slotname [ en-US ] = "Update All Links"; -}; -SfxSlotInfo FN_UPDATE_CUR_TOX -{ - Slotname [ en-US ] = "Update Index"; -}; -SfxSlotInfo FN_EDIT_CURRENT_TOX -{ - Slotname [ en-US ] = "Edit index"; -}; -SfxSlotInfo FN_UPDATE_FIELDS -{ - Slotname [ en-US ] = "Update Fields"; -}; -SfxSlotInfo FN_UPDATE_INPUTFIELDS -{ - Slotname [ en-US ] = "Update Input Fields"; -}; -SfxSlotInfo FN_UPDATE_TOX -{ - Slotname [ en-US ] = "Update Indexes"; -}; -SfxSlotInfo FN_VIEW_BOUNDS -{ - Slotname [ en-US ] = "Text Limits"; -}; -SfxSlotInfo FN_VIEW_FIELDNAME -{ - Slotname [ en-US ] = "Field Names On/Off"; -}; -SfxSlotInfo FN_VIEW_FIELDS -{ - Slotname [ en-US ] = "Fields"; -}; -SfxSlotInfo FN_VIEW_GRAPHIC -{ - Slotname [ en-US ] = "Graphics On/Off"; -}; - -SfxSlotInfo FN_VIEW_HIDDEN_PARA -{ - Slotname [ en-US ] = "Hidden Paragraphs"; -}; -SfxSlotInfo FN_VIEW_MARKS -{ - Slotname [ en-US ] = "Field Shadings"; -}; -SfxSlotInfo FN_VIEW_META_CHARS -{ - Slotname [ en-US ] = "Nonprinting Characters On/Off"; -}; -SfxSlotInfo FN_VIEW_TABLEGRID -{ - Slotname [ en-US ] = "Table Limits"; -}; -SfxSlotInfo FN_VLINEAL -{ - Slotname [ en-US ] = "Vertical Ruler"; -}; -SfxSlotInfo FN_VSCROLLBAR -{ - Slotname [ en-US ] = "Vertical Scroll Bar"; -}; -SfxSlotInfo FN_WRAP_ANCHOR_ONLY -{ - Slotname [ en-US ] = "Wrap First Paragraph"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR_BACKGROUND -{ - Slotname [ en-US ] = "Highlighting"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR_BACKGROUND_EXT -{ - Slotname [ en-US ] = "Highlight Fill"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR_EXT -{ - Slotname [ en-US ] = "Font Color Fill"; -}; -SfxSlotInfo SID_ATTR_CHAR_COLOR2 -{ - Slotname [ en-US ] = "Font Color"; -}; -SfxSlotInfo SID_TEMPLATE_LOAD -{ - Slotname [ en-US ] = "Load Styles"; -}; -SfxSlotInfo FN_FORMAT_COLUMN -{ - Slotname [ en-US ] = "Columns"; -}; -SfxSlotInfo FN_INSERT_MULTI_TOX -{ - - Slotname [ en-US ] = "Insert Index"; -}; -SfxSlotInfo FN_INSERT_AUTH_ENTRY_DLG -{ - Slotname [ en-US ] = "Insert Bibliography Entry"; -}; - -SfxSlotInfo FN_EDIT_AUTH_ENTRY_DLG -{ - Slotname [ en-US ] = "Edit Bibliography Entry"; -}; - -SfxSlotInfo FN_REMOVE_CUR_TOX -{ - Slotname [ en-US ] = "Delete index"; -}; -SfxSlotInfo FN_EDIT_HYPERLINK -{ - Slotname [ en-US ] = "Edit hyperlink"; -}; -SfxSlotInfo FN_SET_MODOPT_TBLNUMFMT -{ - Slotname [ en-US ] = "Number Recognition"; -}; -SfxSlotInfo FN_UPDATE_CHARTS -{ - Slotname [ en-US ] = "Update Charts"; -}; -SfxSlotInfo FN_NAME_SHAPE -{ - Slotname [ en-US ] = "Name..."; -}; -// #i68101# -SfxSlotInfo FN_TITLE_DESCRIPTION_SHAPE -{ - Slotname [ en-US ] = "Description..."; -}; -SfxSlotInfo FN_CLOSE_PAGEPREVIEW -{ - Slotname [ en-US ] = "Close Preview"; -}; - -SfxSlotInfo FN_TO_FOOTNOTE_AREA -{ - Slotname [ en-US ] = "Edit Footnote/Endnote"; -}; - -SfxSlotInfo FN_READONLY_SELECTION_MODE -{ - Slotname [ en-US ] = "Select Text"; -}; - -SfxSlotInfo FN_TABLE_ROW_SPLIT -{ - Slotname [ en-US ] = "Break across page and columns"; -}; -SfxSlotInfo FN_WORDCOUNT_DIALOG -{ - SlotName[ en-US ] = "Word Count"; -}; -SfxSlotInfo FN_TABLE_DELETE_TABLE -{ - SlotName [ en-US ] = "Delete table"; -}; -SfxSlotInfo FN_TABLE_SELECT_CELL -{ - SlotName [ en-US ] = "Select cell"; -}; -SfxSlotInfo FN_CONVERT_TEXT_TO_TABLE -{ - SlotName [ en-US ] = "Convert Text to Table"; -}; - -SfxSlotInfo FN_CONVERT_TABLE_TO_TEXT -{ - SlotName [ en-US ] = "Convert Table to Text"; -}; -SfxSlotInfo FN_TABLE_SORT_DIALOG -{ - SlotName [ en-US ] = "Sort"; -}; -SfxSlotInfo FN_TABLE_HEADLINE_REPEAT -{ - SlotName [ en-US ] = "Heading Rows Repeat"; -}; -SfxSlotInfo FN_XFORMS_DESIGN_MODE -{ - SlotName[ en-US ] = "Design Mode On/Off"; -}; -SfxSlotInfo FN_XFORMS_INIT -{ - SlotName[ en-US ] = "XML Form Document"; -}; -SfxSlotInfo FN_NUM_CONTINUE -{ - SlotName[ en-US ] = "Continue previous numbering"; -}; - -SfxSlotInfo FN_INSERT_RLM -{ - SlotName[ en-US ] = "Right-to-left mark"; -}; -SfxSlotInfo FN_INSERT_LRM -{ - SlotName[ en-US ] = "Left-to-right mark"; -}; -SfxSlotInfo FN_INSERT_ZWSP -{ - SlotName[ en-US ] = "No-width no break"; -}; -SfxSlotInfo FN_INSERT_ZWNBSP -{ - SlotName[ en-US ] = "No-width optional break"; -}; -SfxSlotInfo FN_VIEW_NOTES -{ - Slotname [ en-US ] = "Notes"; -}; - diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx index fcdcd99241f4..85ff12b699e6 100644 --- a/sw/source/core/crsr/crstrvl1.cxx +++ b/sw/source/core/crsr/crstrvl1.cxx @@ -33,26 +33,30 @@ #include <viscrs.hxx> #include <callnk.hxx> -BOOL SwCrsrShell::IsStartWord() const +BOOL SwCrsrShell::IsStartWord( sal_Int16 nWordType ) const { - return pCurCrsr->IsStartWord(); + return pCurCrsr->IsStartWord( nWordType ); } -BOOL SwCrsrShell::IsEndWord() const + +BOOL SwCrsrShell::IsEndWord( sal_Int16 nWordType ) const +{ + return pCurCrsr->IsEndWord( nWordType ); +} + +BOOL SwCrsrShell::IsInWord( sal_Int16 nWordType ) const { - return pCurCrsr->IsEndWord(); + return pCurCrsr->IsInWord( nWordType ); } + BOOL SwCrsrShell::IsStartSentence() const { return pCurCrsr->IsStartEndSentence( false ); } + BOOL SwCrsrShell::IsEndSentence() const { return pCurCrsr->IsStartEndSentence( true ); } -BOOL SwCrsrShell::IsInWord() const -{ - return pCurCrsr->IsInWord(); -} BOOL SwCrsrShell::GoStartWord() diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index d8286d007395..5b381cbaaad2 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1141,19 +1141,19 @@ short SwCursor::MaxReplaceArived() } -BOOL SwCursor::IsStartWord() const +BOOL SwCursor::IsStartWord( sal_Int16 nWordType ) const { - return IsStartWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsStartWordWT( nWordType ); } -BOOL SwCursor::IsEndWord() const +BOOL SwCursor::IsEndWord( sal_Int16 nWordType ) const { - return IsEndWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsEndWordWT( nWordType ); } -BOOL SwCursor::IsInWord() const +BOOL SwCursor::IsInWord( sal_Int16 nWordType ) const { - return IsInWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsInWordWT( nWordType ); } BOOL SwCursor::GoStartWord() diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 7af79fde80a8..32ab9fa07e94 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -1162,8 +1162,7 @@ void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData ) void SwEditShell::TransliterateText( sal_uInt32 nType ) { - utl::TransliterationWrapper aTrans( - ::comphelper::getProcessServiceFactory(), nType ); + utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType ); StartAllAction(); SET_CURR_SHELL( this ); @@ -1185,6 +1184,32 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) EndAllAction(); } +void SwEditShell::TransliterateText( const String& rModuleName ) +{ + utl::TransliterationWrapper aTrans(::comphelper::getProcessServiceFactory(), 0 ); + aTrans.loadModuleByImplName( rModuleName, LANGUAGE_SYSTEM ); + StartAllAction(); + SET_CURR_SHELL( this ); + + SwPaM* pCrsr = GetCrsr(); + if( pCrsr->GetNext() != pCrsr ) + { + GetDoc()->StartUndo(UNDO_EMPTY, NULL); + FOREACHPAM_START( this ) + + if( PCURCRSR->HasMark() ) + GetDoc()->TransliterateText( *PCURCRSR, aTrans ); + + FOREACHPAM_END() + GetDoc()->EndUndo(UNDO_EMPTY, NULL); + } + else + GetDoc()->TransliterateText( *pCrsr, aTrans ); + + EndAllAction(); +} + + void SwEditShell::CountWords( SwDocStat& rStat ) const { FOREACHPAM_START( this ) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 7251d2737256..d5cdbf731375 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3776,7 +3776,8 @@ void MSWordExportBase::OutputStartNode( const SwStartNode & rNode) void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) { #ifdef DEBUG - ::std::clog << "<OutWW8_SwEndNode>" << dbg_out(&rNode) << ::std::endl; +// someone who knows what he wants should make this linkable when building with 'debug=t' ... +// ::std::clog << "<OutWW8_SwEndNode>" << dbg_out(&rNode) << ::std::endl; #endif ww8::WW8TableNodeInfo::Pointer_t pNodeInfo = mpTableInfo->getTableNodeInfo( &rNode ); diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx index 73e5d69d7764..13cec2b93bb5 100644 --- a/sw/source/ui/config/viewopt.cxx +++ b/sw/source/ui/config/viewopt.cxx @@ -112,6 +112,7 @@ BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const && bFormView == rOpt.IsFormView() && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields + && bIdle == rOpt.bIdle #ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src && bTest1 == rOpt.IsTest1() @@ -226,7 +227,7 @@ SwViewOption::SwViewOption() : { // Initialisierung ist jetzt etwas einfacher // alle Bits auf 0 - nCoreOptions = VIEWOPT_1_IDLE | VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | + nCoreOptions = VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | VIEWOPT_1_REF | VIEWOPT_1_GRAPHIC | VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL | @@ -243,6 +244,8 @@ SwViewOption::SwViewOption() : bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly(); + bIdle = true; + #ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src bTest1 = bTest2 = bTest3 = bTest4 = @@ -277,6 +280,7 @@ SwViewOption::SwViewOption(const SwViewOption& rVOpt) bBookview = rVOpt.bBookview; mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; #ifdef DBG_UTIL bTest1 = rVOpt.bTest1 ; @@ -317,6 +321,7 @@ SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt ) bBookview = rVOpt.bBookview; mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; #ifdef DBG_UTIL bTest1 = rVOpt.bTest1 ; diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx index 61d4884157cf..829c79373a61 100644 --- a/sw/source/ui/docvw/SidebarTxtControl.cxx +++ b/sw/source/ui/docvw/SidebarTxtControl.cxx @@ -340,26 +340,32 @@ void SidebarTxtControl::Command( const CommandEvent& rCEvt ) } else { - SfxPopupMenuManager* aMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); - ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) ); + SfxPopupMenuManager* pMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); + ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) ); { - XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); + XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor()); aText = aRewriter.Apply(aText); - ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); + ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); } + Point aPos; if (rCEvt.IsMouseEvent()) - ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel()); + aPos = rCEvt.GetMousePosPixel(); else { const Size aSize = GetSizePixel(); - const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); - ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos); + aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); } - delete aMgr; + + //!! call different Execute function to get rid of the new thesaurus sub menu + //!! pointer created in the call to Popup. + //!! Otherwise we would have a memory leak (see also #i107205#) + //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos ); + pMgr->Execute( aPos, this ); + delete pMgr; } } else diff --git a/sw/source/ui/inc/langhelper.hxx b/sw/source/ui/inc/langhelper.hxx index 0d05c930284a..3ff795d83f56 100755 --- a/sw/source/ui/inc/langhelper.hxx +++ b/sw/source/ui/inc/langhelper.hxx @@ -31,31 +31,37 @@ class SwWrtShell; class SwView; class EditEngine; class EditView; +class OutlinerView; class SfxItemSet; struct ESelection; namespace SwLangHelper { - extern USHORT GetLanguageStatus(OutlinerView* pOLV,SfxItemSet& rSet); - extern bool SetLanguageStatus(OutlinerView* pOLV,SfxRequest &rReq,SwView &rView,SwWrtShell &rSh); + extern USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ); + extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh ); - extern void SetLanguage(SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet); - extern void SetLanguage(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet); - extern void SetLanguage_None(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); - extern void SetLanguage_None(SwWrtShell &rWrtSh,bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); +// extern void SetLanguage( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ); +// extern void SetLanguage_None( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection ); +// extern void ResetLanguages( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection ); + extern void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection ); // document extern void SelectCurrentPara( SwWrtShell &rWrtSh ); // EditView extern void SelectPara( EditView &rEditView, const ESelection &rCurSel ); - extern String GetTextForLanguageGuessing(EditEngine* rEditEngine, ESelection aDocSelection ); + extern String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection ); extern String GetTextForLanguageGuessing( SwWrtShell &rSh ); extern LanguageType GetLanguage( SfxItemSet aSet, USHORT nLangWhichId ); extern LanguageType GetLanguage( SwWrtShell &rSh, USHORT nLangWhichId ); - extern LanguageType GetCurrentLanguage(SfxItemSet aSet,USHORT nScriptType ); + extern LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType ); extern LanguageType GetCurrentLanguage( SwWrtShell &rSh ); } diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx index 3bc0eb02d3b6..ef6a26e73f67 100644 --- a/sw/source/ui/inc/olmenu.hxx +++ b/sw/source/ui/inc/olmenu.hxx @@ -51,23 +51,22 @@ class SwSpellPopup : public PopupMenu ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt; ::com::sun::star::uno::Sequence< rtl::OUString > aSuggestions; - LanguageType nCheckedLanguage; + LanguageType nCheckedLanguage; LanguageType nGuessLangWord; LanguageType nGuessLangPara; - USHORT nNumLanguageTextEntries; - USHORT nNumLanguageParaEntries; - USHORT nNumLanguageDocEntries; std::map< sal_Int16, ::rtl::OUString > aLangTable_Text; std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph; - std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; +// std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; bool bGrammarResults; // show grammar results? Or show spellcheck results? Image aInfo16; - USHORT fillLangPopupMenu( PopupMenu *pPopupMenu , USHORT Lang_Start, ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq,SwWrtShell* pWrtSh, USHORT nLangTable); + void fillLangPopupMenu( PopupMenu *pPopupMenu, USHORT nLangStart, + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq, SwWrtShell* pWrtSh, + std::map< sal_Int16, ::rtl::OUString > &rLangTable ); using PopupMenu::Execute; diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 0c16e8bf132e..c59bb1535bad 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -437,6 +437,12 @@ public: virtual USHORT PrepareClose( BOOL bUI = TRUE, BOOL bForBrowsing = FALSE ); virtual void MarginChanged(); + // replace word/selection with text from the thesaurus + // (this code has special handling for "in word" character) + void InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bValidSelection ); + bool IsValidSelectionForThesaurus() const; + String GetThesaurusLookUpText( bool bSelection ) const; + // Shell sofort wechseln -> fuer GetSelectionObject void StopShellTimer(); diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 9ebfd8c8cf36..959f566da9a2 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -28,85 +28,84 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> +#include "SwRewriter.hxx" +#include "chrdlg.hrc" +#include "cmdid.h" +#include "comcore.hrc" +#include "crsskip.hxx" +#include "doc.hxx" +#include "docsh.hxx" //CheckSpellChanges +#include "edtwin.hxx" +#include "helpid.h" +#include "hintids.hxx" +#include "langhelper.hxx" +#include "ndtxt.hxx" +#include "olmenu.hrc" +#include "olmenu.hxx" +#include "swabstdlg.hxx" +#include "swmodule.hxx" +#include "swtypes.hxx" +#include "swundo.hxx" +#include "uitool.hxx" +#include "undobj.hxx" +#include "unomid.h" +#include "view.hxx" +#include "viewopt.hxx" +#include "wrtsh.hxx" +#include "wview.hxx" +#include "swabstdlg.hxx" +#include "chrdlg.hrc" + #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> #endif -#include <unotools/lingucfg.hxx> -#include <unotools/linguprops.hxx> -#include <svtools/filter.hxx> -#include <editeng/svxacorr.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/imagemgr.hxx> -#include <osl/file.hxx> -#include <rtl/string.hxx> +#include <comphelper/processfactory.hxx> +#include <editeng/acorrcfg.hxx> +#include <editeng/svxacorr.hxx> +#include <editeng/langitem.hxx> +#include <editeng/splwrap.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/unolingu.hxx> #include <i18npool/mslangid.hxx> #include <linguistic/lngprops.hxx> #include <linguistic/misc.hxx> -#include <comphelper/processfactory.hxx> -#include <editeng/unolingu.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/linguistic2/XSpellChecker1.hpp> -#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> -#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/i18n/ScriptType.hpp> -#include <svx/dlgutil.hxx> +#include <osl/file.hxx> +#include <rtl/string.hxx> +#include <svtools/filter.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/imagemgr.hxx> +#include <sfx2/request.hxx> +#include <sfx2/sfxdlg.hxx> #include <svl/itemset.hxx> -#include <editeng/langitem.hxx> -#include <editeng/splwrap.hxx> -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> -#include <unotools/lingucfg.hxx> -#include <editeng/acorrcfg.hxx> -#include <swmodule.hxx> -#include <cmdid.h> -#include <helpid.h> -#include <swtypes.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <docsh.hxx> //CheckSpellChanges -#include <olmenu.hxx> -#include <swundo.hxx> -#include <crsskip.hxx> -#include <ndtxt.hxx> -#include <olmenu.hrc> -#include <doc.hxx> - -// -> #111827# -#include <SwRewriter.hxx> -#include <comcore.hrc> -#include <undobj.hxx> -// <- #111827# - -#include <unomid.h> #include <svl/languageoptions.hxx> -#include <map> -#include <svtools/langtab.hxx> -#include <com/sun/star/document/XDocumentLanguages.hpp> -#include <edtwin.hxx> -#include <sfx2/sfxdlg.hxx> -#include "swabstdlg.hxx" -#include "chrdlg.hrc" -#include <editeng/brshitem.hxx> #include <svl/stritem.hxx> -#include <viewopt.hxx> -#include <uitool.hxx> +#include <svtools/filter.hxx> +#include <svtools/langtab.hxx> +#include <svx/dlgutil.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/linguprops.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> -#include <wview.hxx> -#include <sfx2/request.hxx> +#include <map> -#include <vcl/msgbox.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/document/XDocumentLanguages.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> +#include <com/sun/star/linguistic2/XSpellChecker1.hpp> +#include <com/sun/star/uno/Any.hxx> -#include <langhelper.hxx> using namespace ::com::sun::star; using ::rtl::OUString; @@ -214,63 +213,59 @@ inline bool lcl_checkScriptType( sal_Int16 nScriptType, LanguageType nLang ) return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); } -USHORT SwSpellPopup::fillLangPopupMenu( +void SwSpellPopup::fillLangPopupMenu( PopupMenu *pPopupMenu, - USHORT Lang_Start, - uno::Sequence< ::rtl::OUString > aSeq, + USHORT nLangItemIdStart, + uno::Sequence< OUString > aSeq, SwWrtShell* pWrtSh, - USHORT nLangTable ) + std::map< sal_Int16, ::rtl::OUString > &rLangTable ) { if (!pPopupMenu) - return 0; - - //Reference< awt::XMenuExtended > m_xMenuExtended( m_xPopupMenu, UNO_QUERY ); - std::map< ::rtl::OUString, ::rtl::OUString > LangItems; + return; SvtLanguageTable aLanguageTable; - USHORT nItemId = Lang_Start; - rtl::OUString curLang = aSeq[0]; - USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); - rtl::OUString keyboardLang = aSeq[2]; - rtl::OUString guessLang = aSeq[3]; - - //1--add current language - if(curLang!=OUString::createFromAscii("")) - { - LangItems[curLang]=curLang; - } - SvtLanguageTable aLangTable; + // set of languages to be displayed in the sub menus + std::set< OUString > aLangItems; + + OUString aCurLang( aSeq[0] ); + USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); + OUString aKeyboardLang( aSeq[2] ); + OUString aGuessedTextLang( aSeq[3] ); + + if (aCurLang != OUString() && + LANGUAGE_DONTKNOW != aLanguageTable.GetType( aCurLang )) + aLangItems.insert( aCurLang ); + //2--System - const AllSettings& rAllSettings=Application::GetSettings(); + const AllSettings& rAllSettings = Application::GetSettings(); LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if(rSystemLanguage!=LANGUAGE_DONTKNOW) + if (rSystemLanguage != LANGUAGE_DONTKNOW) { - if (lcl_checkScriptType(nScriptType,rSystemLanguage )) - LangItems[OUString(aLangTable.GetString(rSystemLanguage))]=OUString(aLangTable.GetString(rSystemLanguage)); + if (lcl_checkScriptType( nScriptType, rSystemLanguage )) + aLangItems.insert( aLanguageTable.GetString(rSystemLanguage) ); } //3--UI LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if(rUILanguage!=LANGUAGE_DONTKNOW) + if (rUILanguage != LANGUAGE_DONTKNOW) { if (lcl_checkScriptType(nScriptType, rUILanguage )) - LangItems[OUString(aLangTable.GetString(rUILanguage))]=OUString(aLangTable.GetString(rUILanguage)); + aLangItems.insert( aLanguageTable.GetString(rUILanguage) ); } //4--guessed language - if(guessLang!=OUString::createFromAscii("")) + if (aGuessedTextLang.getLength() > 0) { - if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(guessLang))) - LangItems[guessLang]=guessLang; + if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aGuessedTextLang))) + aLangItems.insert( aGuessedTextLang ); } - //5--keyboard language - if(keyboardLang!=OUString::createFromAscii("")) + if (aKeyboardLang.getLength() > 0) { - if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(keyboardLang))) - LangItems[keyboardLang]=keyboardLang; + if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aKeyboardLang))) + aLangItems.insert( aKeyboardLang ); } //6--all languages used in current document @@ -278,74 +273,58 @@ USHORT SwSpellPopup::fillLangPopupMenu( uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY ); if ( xController.is() ) xModel = xController->getModel(); - uno::Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, uno::UNO_QUERY ); - /*the description of nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 + /*the description of nScriptType flags + LATIN : 0x0001 + ASIAN : 0x0002 + COMPLEX: 0x0004 */ - - sal_Int16 nCount=7; - if(xDocumentLanguages.is()) + const sal_Int16 nMaxCount = 7; + if (xDocumentLanguages.is()) { - uno::Sequence< lang::Locale > rLocales(xDocumentLanguages->getDocumentLanguages(nScriptType,nCount)); - if(rLocales.getLength()>0) + uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount ) ); + if (rLocales.getLength() > 0) { - for(USHORT i = 0; i<rLocales.getLength();++i) + for (USHORT i = 0; i < rLocales.getLength(); ++i) { - if (LangItems.size()==7) + if (aLangItems.size() == (size_t)nMaxCount) break; - const lang::Locale& rLocale=rLocales[i]; - if(lcl_checkScriptType(nScriptType, aLanguageTable.GetType(rLocale.Language))) - LangItems[ rtl::OUString(rLocale.Language)]=OUString(rLocale.Language); + const lang::Locale& rLocale = rLocales[i]; + if (lcl_checkScriptType( nScriptType, aLanguageTable.GetType( rLocale.Language ))) + aLangItems.insert( rLocale.Language ); } } } - bool bMultipleLanguages = (nLangTable != 0) || (curLang.compareToAscii( "*" ) == 0); - bool bNothingSelected = true; - MenuItemBits nMenuItemStyle = !bMultipleLanguages ? MIB_RADIOCHECK : 0; - for (std::map< rtl::OUString, rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it) + + USHORT nItemId = nLangItemIdStart; + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - rtl::OUString aEntryTxt( it->first ); - if (aEntryTxt != rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - aEntryTxt != rtl::OUString::createFromAscii("*") && - aEntryTxt.getLength() > 0) + OUString aEntryTxt( *it ); + if (aEntryTxt != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + aEntryTxt != sAsterix && + aEntryTxt != sEmpty) { - ++nItemId; - if (nLangTable == 0) // language for selection - aLangTable_Text[nItemId] = aEntryTxt; - else if (nLangTable == 1) // language for paragraph - aLangTable_Paragraph[nItemId] = aEntryTxt; - else if (nLangTable == 2) // language for document - aLangTable_Document[nItemId] = aEntryTxt; - - pPopupMenu->InsertItem( nItemId, aEntryTxt, nMenuItemStyle ); - if ((nLangTable == 0) && (aEntryTxt == curLang)) + DBG_ASSERT( nLangItemIdStart <= nItemId && nItemId <= nLangItemIdStart + MN_MAX_NUM_LANG, + "nItemId outside of expected range!" ); + pPopupMenu->InsertItem( nItemId, aEntryTxt, MIB_RADIOCHECK ); + if (aEntryTxt == aCurLang) { //make a check mark for the current language pPopupMenu->CheckItem( nItemId, TRUE ); bNothingSelected = false; } + rLangTable[ nItemId ] = aEntryTxt; + ++nItemId; } } - //7--none - nItemId++; - pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), nMenuItemStyle ); - if (bNothingSelected && !bMultipleLanguages) - pPopupMenu->CheckItem( nItemId, TRUE ); - - //More... - nItemId++; - pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )) ); - - return nItemId - Lang_Start; // return number of inserted entries + pPopupMenu->InsertItem( nLangItemIdStart + MN_NONE_OFFSET, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK ); + pPopupMenu->InsertItem( nLangItemIdStart + MN_RESET_OFFSET, String(SW_RES( STR_RESET_TO_DEFAULT_LANGUAGE )), MIB_RADIOCHECK ); + pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK ); } @@ -368,22 +347,22 @@ static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) } -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) +OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) { - ::rtl::OUString aLabel; + OUString aLabel; if ( aCmdURL.getLength() ) { try { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); + uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); if ( xNameAccess.is() ) { uno::Reference< container::XNameAccess > xUICommandLabels; - const ::rtl::OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); + const OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); uno::Any a = xNameAccess->getByName( aModule ); uno::Reference< container::XNameAccess > xUICommands; a >>= xUICommandLabels; - rtl::OUString aStr; + OUString aStr; uno::Sequence< beans::PropertyValue > aPropSeq; a = xUICommandLabels->getByName( aCmdURL ); if ( a >>= aPropSeq ) @@ -448,25 +427,28 @@ bGrammarResults(false) InsertSeparator(0); bEnable = sal_True; - for( sal_uInt16 i = 0, nPos = 1, nId = MN_AUTOCORR_START + 1; - i < nStringCount; ++i, ++nPos, ++nId ) + USHORT nAutoCorrItemId = MN_AUTOCORR_START; + USHORT nItemId = MN_SUGGESTION_START; + for (USHORT i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; - InsertItem( nPos, aEntry, 0, i ); - SetHelpId( nPos, HID_LINGU_REPLACE); - + InsertItem( nItemId, aEntry, 0, i ); + SetHelpId( nItemId, HID_LINGU_REPLACE); if (aSuggestionImageUrl.getLength() > 0) - SetItemImage( nPos, aImage ); + SetItemImage( nItemId, aImage ); + + pMenu->InsertItem( nAutoCorrItemId, aEntry ); + pMenu->SetHelpId( nAutoCorrItemId, HID_LINGU_AUTOCORR); - pMenu->InsertItem( nId, aEntry ); - pMenu->SetHelpId( nPos, HID_LINGU_AUTOCORR); + ++nAutoCorrItemId; + ++nItemId; } } OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); - SetItemText( MN_SPELLING, aSpellingAndGrammar ); - USHORT nItemPos = GetItemPos( MN_IGNORE ); + SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE_WORD ); InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); @@ -489,11 +471,9 @@ bGrammarResults(false) nGuessLangPara = nGuessLangWord; } - pMenu = GetPopupMenu(MN_INSERT); - - bEnable = FALSE; // enable MN_INSERT? - + pMenu = GetPopupMenu(MN_ADD_TO_DIC); pMenu->CreateAutoMnemonics(); + bEnable = FALSE; // enable MN_ADD_TO_DIC? uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); if (xDicList.is()) { @@ -508,6 +488,7 @@ bGrammarResults(false) const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray(); USHORT nDicCount = static_cast< USHORT >(aDics.getLength()); + USHORT nItemId = MN_DICTIONARIES_START; for( USHORT i = 0; i < nDicCount; i++ ) { uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); @@ -523,8 +504,7 @@ bGrammarResults(false) { // the extra 1 is because of the (possible) external // linguistic entry above - USHORT nPos = MN_INSERT_START + i + 1; - pMenu->InsertItem( nPos, xDicTmp->getName() ); + pMenu->InsertItem( nItemId, xDicTmp->getName() ); bEnable = sal_True; uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); @@ -535,18 +515,20 @@ bGrammarResults(false) if (aDictionaryImageUrl.getLength() > 0) { Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); - pMenu->SetItemImage( nPos, aImage ); + pMenu->SetItemImage( nItemId, aImage ); } } + + ++nItemId; } } } - EnableItem( MN_INSERT, bEnable ); + EnableItem( MN_ADD_TO_DIC, bEnable ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) ); - SvtLanguageTable aLangTable; + SvtLanguageTable aLanguageTable; // get keyboard language String aKeyboardLang; @@ -554,39 +536,40 @@ bGrammarResults(false) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) - aKeyboardLang = aLangTable.GetString( nLang ); + aKeyboardLang = aLanguageTable.GetString( nLang ); // get the language that is in use const String aMultipleLanguages = String::CreateFromAscii("*"); String aCurrentLang = aMultipleLanguages; nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh ); if (nLang != LANGUAGE_DONTKNOW) - aCurrentLang = aLangTable.GetString( nLang ); + aCurrentLang = aLanguageTable.GetString( nLang ); // build sequence for status value - uno::Sequence< ::rtl::OUString > aSeq( 4 ); + uno::Sequence< OUString > aSeq( 4 ); aSeq[0] = aCurrentLang; aSeq[1] = aScriptTypesInUse; aSeq[2] = aKeyboardLang; - aSeq[3] = aLangTable.GetString(nGuessLangWord); + aSeq[3] = aLanguageTable.GetString(nGuessLangWord); - pMenu = GetPopupMenu(MN_LANGUAGE_SELECTION); - nNumLanguageTextEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_SELECTION_START, aSeq, pWrtSh, 0 ); - EnableItem( MN_LANGUAGE_SELECTION, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text ); + EnableItem( MN_SET_LANGUAGE_SELECTION, true ); - pMenu = GetPopupMenu(MN_LANGUAGE_PARAGRAPH); - nNumLanguageParaEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, 1 ); - EnableItem( MN_LANGUAGE_PARAGRAPH, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph ); + EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true ); /* - pMenu = GetPopupMenu(MN_LANGUAGE_ALL_TEXT); - nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); - EnableItem( MN_LANGUAGE_ALL_TEXT, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document ); + EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true ); */ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, - ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); + ////////////////////////////////////////////////////////////////////////////////// RemoveDisabledEntries( TRUE, TRUE ); @@ -601,7 +584,7 @@ SwSpellPopup::SwSpellPopup( SwWrtShell *pWrtSh, const linguistic2::ProofreadingResult &rResult, sal_Int32 nErrorInResult, - const uno::Sequence< rtl::OUString > &rSuggestions, + const uno::Sequence< OUString > &rSuggestions, const String &rParaText ) : PopupMenu( SW_RES(MN_SPELL_POPUP) ), pSh( pWrtSh ), @@ -611,13 +594,11 @@ aInfo16( SW_RES(IMG_INFO_16) ) { nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale ); - sal_Int16 nItemId = 1; - sal_Int16 nPos = 0; + USHORT nPos = 0; OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment ); InsertSeparator( nPos++ ); - InsertItem( nItemId, aMessageText, MIB_NOSELECT, nPos++ ); - SetItemImage( nItemId, aInfo16 ); - ++nItemId; + InsertItem( MN_SHORT_COMMENT, aMessageText, MIB_NOSELECT, nPos++ ); + SetItemImage( MN_SHORT_COMMENT, aInfo16 ); CreateAutoMnemonics(); @@ -634,12 +615,12 @@ aInfo16( SW_RES(IMG_INFO_16) ) aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); } + USHORT nItemId = MN_SUGGESTION_START; for (sal_uInt16 i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; InsertItem( nItemId, aEntry, 0, nPos++ ); SetHelpId( nItemId, HID_LINGU_REPLACE ); - if (aSuggestionImageUrl.getLength() > 0) SetItemImage( nItemId, aImage ); @@ -650,8 +631,8 @@ aInfo16( SW_RES(IMG_INFO_16) ) OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); - SetItemText( MN_SPELLING, aSpellingAndGrammar ); - USHORT nItemPos = GetItemPos( MN_IGNORE ); + SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE_WORD ); InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); @@ -674,13 +655,13 @@ aInfo16( SW_RES(IMG_INFO_16) ) nGuessLangPara = nGuessLangWord; } - EnableItem( MN_IGNORE, false ); - EnableItem( MN_INSERT, false ); + EnableItem( MN_IGNORE_WORD, false ); + EnableItem( MN_ADD_TO_DIC, false ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) ); - SvtLanguageTable aLangTable; + SvtLanguageTable aLanguageTable; // get keyboard language String aKeyboardLang; @@ -688,39 +669,39 @@ aInfo16( SW_RES(IMG_INFO_16) ) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) - aKeyboardLang = aLangTable.GetString( nLang ); + aKeyboardLang = aLanguageTable.GetString( nLang ); // get the language that is in use const String aMultipleLanguages = String::CreateFromAscii("*"); String aCurrentLang = aMultipleLanguages; nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh ); if (nLang != LANGUAGE_DONTKNOW) - aCurrentLang = aLangTable.GetString( nLang ); + aCurrentLang = aLanguageTable.GetString( nLang ); // build sequence for status value - uno::Sequence< ::rtl::OUString > aSeq( 4 ); + uno::Sequence< OUString > aSeq( 4 ); aSeq[0] = aCurrentLang; aSeq[1] = aScriptTypesInUse; aSeq[2] = aKeyboardLang; - aSeq[3] = aLangTable.GetString(nGuessLangWord); + aSeq[3] = aLanguageTable.GetString(nGuessLangWord); - PopupMenu *pMenu = GetPopupMenu(MN_LANGUAGE_SELECTION); - nNumLanguageTextEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_SELECTION_START, aSeq, pWrtSh, 0 ); - EnableItem( MN_LANGUAGE_SELECTION, true ); + PopupMenu *pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text ); + EnableItem( MN_SET_LANGUAGE_SELECTION, true ); - pMenu = GetPopupMenu(MN_LANGUAGE_PARAGRAPH); - nNumLanguageParaEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, 1 ); - EnableItem( MN_LANGUAGE_PARAGRAPH, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph ); + EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true ); /* - pMenu = GetPopupMenu(MN_LANGUAGE_ALL_TEXT); - nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); - EnableItem( MN_LANGUAGE_ALL_TEXT, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document ); + EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true ); */ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, - ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); ////////////////////////////////////////////////////////////////////////////////// @@ -743,25 +724,23 @@ sal_uInt16 SwSpellPopup::Execute( const Rectangle& rWordPos, Window* pWin ) -----------------------------------------------------------------------*/ void SwSpellPopup::Execute( USHORT nId ) { - if (bGrammarResults && nId == 1) - return; // nothing to do since it is the error message (short comment) + if (nId == USHRT_MAX) + return; - sal_Bool bAutoCorr = sal_False; - if( nId > MN_AUTOCORR_START && nId < MN_LANGUAGE_SELECTION_START && nId != USHRT_MAX ) - { - nId -= MN_AUTOCORR_START; - bAutoCorr = sal_True; - } + if (/*bGrammarResults && */nId == MN_SHORT_COMMENT) + return; // nothing to do since it is the error message (short comment) - if( nId && nId != USHRT_MAX) + if ((MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) || + (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END)) { - int nAltIdx = bGrammarResults ? nId - 2 : nId - 1; - if ( nAltIdx >= 0 && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is()) ) + sal_Int32 nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ? + nId - MN_SUGGESTION_START : nId - MN_AUTOCORR_START; + DBG_ASSERT( 0 <= nAltIdx && nAltIdx < aSuggestions.getLength(), "index out of range" ); + if (0 <= nAltIdx && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is())) { sal_Bool bOldIns = pSh->IsInsMode(); pSh->SetInsMode( sal_True ); - DBG_ASSERT( 0 <= nAltIdx && nAltIdx <= aSuggestions.getLength(), "index out of range"); String aTmp( aSuggestions[ nAltIdx ] ); String aOrig( bGrammarResults ? OUString() : xSpellAlt->getWord() ); @@ -780,40 +759,30 @@ void SwSpellPopup::Execute( USHORT nId ) aRewriter.AddRule(UNDO_ARG1, pSh->GetCrsrDescr()); aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS))); - { - String aTmpStr; - - aTmpStr += String(SW_RES(STR_START_QUOTE)); - aTmpStr += aTmp; - aTmpStr += String(SW_RES(STR_END_QUOTE)); - aRewriter.AddRule(UNDO_ARG3, aTmpStr); - } + String aTmpStr( SW_RES(STR_START_QUOTE) ); + aTmpStr += aTmp; + aTmpStr += String(SW_RES(STR_END_QUOTE)); + aRewriter.AddRule(UNDO_ARG3, aTmpStr); pSh->StartUndo(UNDO_UI_REPLACE, &aRewriter); pSh->StartAction(); pSh->DelLeft(); pSh->Insert( aTmp ); + /* #102505# EndAction/EndUndo moved down since insertion of temporary auto correction is now undoable two and must reside in the same undo group.*/ - // nur aufnehmen, wenn es NICHT schon in der Autokorrektur vorhanden ist SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect(); String aOrigWord( bGrammarResults ? OUString() : xSpellAlt->getWord() ) ; - String aNewWord; - if( nId ) - aNewWord = aSuggestions[ nAltIdx ]; - else - aNewWord = aOrigWord; + String aNewWord( aSuggestions[ nAltIdx ] ); SvxPrepareAutoCorrect( aOrigWord, aNewWord ); - if( bAutoCorr ) - { + if (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END) pACorr->PutText( aOrigWord, aNewWord, nCheckedLanguage ); - } /* #102505# EndAction/EndUndo moved down since insertion of temporary auto correction is now undoable two and @@ -823,180 +792,140 @@ void SwSpellPopup::Execute( USHORT nId ) pSh->SetInsMode( bOldIns ); } - else + } + else if (nId == MN_SPELLING_DLG) + { + if (bGrammarResults) + { + SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); + } + pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); { - if (nId < MN_LANGUAGE_SELECTION_START) + uno::Reference<linguistic2::XDictionaryList> xDictionaryList( SvxGetDictionaryList() ); + SvxDicListChgClamp aClamp( xDictionaryList ); + pSh->GetView().GetViewFrame()->GetDispatcher()-> + Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON ); + } + } + else if (nId == MN_IGNORE_SELECTION) + { + SwPaM *pPaM = pSh->GetCrsr(); + if (pPaM) + pSh->IgnoreGrammarErrorAt( *pPaM ); + } + else if (nId == MN_IGNORE_WORD) + { + uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); + linguistic::AddEntryToDic( xDictionary, + xSpellAlt->getWord(), sal_False, aEmptyStr, LANGUAGE_NONE ); + } + else if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) + { + OUString aWord( xSpellAlt->getWord() ); + USHORT nDicIdx = nId - MN_DICTIONARIES_START; + DBG_ASSERT( nDicIdx < aDics.getLength(), "dictionary index out of range" ); + + if (nDicIdx < aDics.getLength()) { - switch( nId ) + uno::Reference< linguistic2::XDictionary > xDic = aDics.getConstArray()[nDicIdx]; + INT16 nAddRes = linguistic::AddEntryToDic( xDic, aWord, FALSE, aEmptyStr, LANGUAGE_NONE ); + // save modified user-dictionary if it is persistent + uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); + if (xSavDic.is()) + xSavDic->store(); + + if (DIC_ERR_NONE != nAddRes + && !xDic->getEntry( aWord ).is()) { - case MN_SPELLING: - { - if (bGrammarResults) - { - SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); - } - pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); - { - uno::Reference<linguistic2::XDictionaryList> xDictionaryList( SvxGetDictionaryList() ); - SvxDicListChgClamp aClamp( xDictionaryList ); - pSh->GetView().GetViewFrame()->GetDispatcher()-> - Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON ); - } - } - break; - case MN_IGNORE_SELECTION : - { - SwPaM *pPaM = pSh->GetCrsr(); - if (pPaM) - pSh->IgnoreGrammarErrorAt( *pPaM ); - } - break; - case MN_IGNORE : - { - uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); - linguistic::AddEntryToDic( - xDictionary, - xSpellAlt->getWord(), sal_False, - aEmptyStr, LANGUAGE_NONE ); - } - break; - case MN_INSERT: - DBG_ERROR("geht noch nicht!"); - break; - case MN_LANGUAGE_WORD: - case MN_LANGUAGE_PARA: - { - pSh->StartAction(); - - if( MN_LANGUAGE_PARA == nId ) - { - if( !pSh->IsSttPara() ) - pSh->MovePara( fnParaCurr, fnParaStart ); - pSh->SwapPam(); - if( !pSh->IsEndPara() ) - pSh->MovePara( fnParaCurr, fnParaEnd ); - } - - LanguageType nLangToUse = (MN_LANGUAGE_PARA == nId) ? nGuessLangPara : nGuessLangWord; - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse ); - USHORT nResId = 0; - switch (nScriptType) - { - case SCRIPTTYPE_COMPLEX : nResId = RES_CHRATR_CTL_LANGUAGE; break; - case SCRIPTTYPE_ASIAN : nResId = RES_CHRATR_CJK_LANGUAGE; break; - default /*SCRIPTTYPE_LATIN*/: nResId = RES_CHRATR_LANGUAGE; break; - } - SfxItemSet aSet(pSh->GetAttrPool(), nResId, nResId ); - aSet.Put( SvxLanguageItem( nLangToUse, nResId ) ); - pSh->SetAttr( aSet ); - - pSh->EndAction(); - } - break; - default: - if(nId >= MN_INSERT_START ) - { - OUString aWord( xSpellAlt->getWord() ); - INT32 nDicIdx = nId - MN_INSERT_START - 1; - DBG_ASSERT( nDicIdx < aDics.getLength(), - "dictionary index out of range" ); - uno::Reference< linguistic2::XDictionary > xDic = - aDics.getConstArray()[nDicIdx]; - INT16 nAddRes = linguistic::AddEntryToDic( xDic, - aWord, FALSE, aEmptyStr, LANGUAGE_NONE ); - // save modified user-dictionary if it is persistent - uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); - if (xSavDic.is()) - xSavDic->store(); - - if (DIC_ERR_NONE != nAddRes - && !xDic->getEntry( aWord ).is()) - { - SvxDicError( - &pSh->GetView().GetViewFrame()->GetWindow(), - nAddRes ); - } - } + SvxDicError( + &pSh->GetView().GetViewFrame()->GetWindow(), + nAddRes ); } } - else - { - SfxItemSet aCoreSet( pSh->GetView().GetPool(), - RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, - RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, - RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, - 0 ); - String aNewLangTxt; - -// pSh->StartAction(); + } + else + { + // Set language for selection or for paragraph... - if (nId >= MN_LANGUAGE_SELECTION_START && nId < MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries - 1) - { - //Set language for current selection - aNewLangTxt=aLangTable_Text[nId]; - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); - } - else if (nId == MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries - 1) - { - //Set Language_None for current selection - SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); - } - else if (nId == MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries) - { - //Open Format/Character Dialog - lcl_CharDialog( *pSh, true, nId, 0, 0 ); - } - else if (nId >= MN_LANGUAGE_PARAGRAPH_START && nId < MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries - 1) - { - //Set language for current paragraph - aNewLangTxt=aLangTable_Paragraph[nId]; - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId == MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries - 1) - { - //Set Language_None for current paragraph - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId == MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries) - { - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - //Open Format/Character Dialog - lcl_CharDialog( *pSh, true, nId, 0, 0 ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId >= MN_LANGUAGE_ALL_TEXT_START && nId < MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) - { - //Set selected language as the default language - aNewLangTxt=aLangTable_Document[nId]; - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, false, aCoreSet ); - } - else if (nId == MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) - { - //Set Language_None as the default language - SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet ); - } - else if (nId == MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries) - { - // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); - pDlg->Execute(); - delete pDlg; - } - } + SfxItemSet aCoreSet( pSh->GetView().GetPool(), + RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, + RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, + RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, + 0 ); + String aNewLangTxt; -// pSh->EndAction(); + if (MN_SET_LANGUAGE_SELECTION_START <= nId && nId <= MN_SET_LANGUAGE_SELECTION_END) + { + //Set language for current selection + aNewLangTxt = aLangTable_Text[nId]; + SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); + } + else if (nId == MN_SET_SELECTION_NONE) + { + //Set Language_None for current selection + SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); + } + else if (nId == MN_SET_SELECTION_RESET) + { + //reset languages for current selection + SwLangHelper::ResetLanguages( *pSh, true ); + } + else if (nId == MN_SET_SELECTION_MORE) + { + //Open Format/Character Dialog + lcl_CharDialog( *pSh, true, nId, 0, 0 ); + } + else if (MN_SET_LANGUAGE_PARAGRAPH_START <= nId && nId <= MN_SET_LANGUAGE_PARAGRAPH_END) + { + //Set language for current paragraph + aNewLangTxt = aLangTable_Paragraph[nId]; + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_NONE) + { + //Set Language_None for current paragraph + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_RESET) + { + //reset languages for current paragraph + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::ResetLanguages( *pSh, true ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_MORE) + { + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + //Open Format/Character Dialog + lcl_CharDialog( *pSh, true, nId, 0, 0 ); + pSh->Pop( FALSE ); // restore cursor + } +#if 0 + else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) + { + //Set Language_None as the default language + SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet ); + } + else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries) + { + // open the dialog "Tools/Options/Language Settings - Language" + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if (pFact) + { + VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); + pDlg->Execute(); + delete pDlg; } } +#endif } pSh->EnterStdMode(); diff --git a/sw/source/ui/lingu/olmenu.hrc b/sw/source/ui/lingu/olmenu.hrc index 11e7b03d440b..887f8a2ad3af 100644 --- a/sw/source/ui/lingu/olmenu.hrc +++ b/sw/source/ui/lingu/olmenu.hrc @@ -30,35 +30,65 @@ #include "rcid.hrc" -#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1) -#define STR_SPELL_OK (RC_LINGU_BEGIN + 2) -#define STR_HYP_OK (RC_LINGU_BEGIN + 3) -#define STR_WORD (RC_LINGU_BEGIN + 4) -#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5) -#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) -#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) -#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8) +#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1) +#define STR_SPELL_OK (RC_LINGU_BEGIN + 2) +#define STR_HYP_OK (RC_LINGU_BEGIN + 3) +#define STR_WORD (RC_LINGU_BEGIN + 4) +#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5) +#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) +#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) +#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8) +#define STR_RESET_TO_DEFAULT_LANGUAGE (RC_LINGU_BEGIN + 9) -#define IMG_INFO_16 (RC_LINGU_BEGIN + 8) +#define IMG_INFO_16 (RC_LINGU_BEGIN + 100) //! Don't change these values. You may break context menu modifying extensions! -#define MN_SPELLING 100 -#define MN_IGNORE_SELECTION 101 -#define MN_IGNORE 102 -#define MN_INSERT 103 -#define MN_AUTOCORR 104 -#define MN_LANGUAGE_WORD 105 -#define MN_LANGUAGE_PARA 106 -#define MN_LANGUAGE_SELECTION 107 -#define MN_LANGUAGE_PARAGRAPH 108 -#define MN_LANGUAGE_ALL_TEXT 109 - -#define MN_INSERT_START 500 -#define MN_AUTOCORR_START 900 - -#define MN_LANGUAGE_SELECTION_START 1170 -#define MN_LANGUAGE_PARAGRAPH_START 1270 -#define MN_LANGUAGE_ALL_TEXT_START 1370 +#define MN_SPELLING_DLG 200 +#define MN_IGNORE_SELECTION 201 +#define MN_IGNORE_WORD 202 +#define MN_ADD_TO_DIC 203 +#define MN_AUTOCORR 204 +#define MN_SET_LANGUAGE_SELECTION 205 +#define MN_SET_LANGUAGE_PARAGRAPH 206 +#define MN_SET_LANGUAGE_ALL_TEXT 207 +#define MN_SHORT_COMMENT 208 + +// id range for dictionaries sub menu +#define MN_DICTIONARIES_START 300 +#define MN_DICTIONARIES_END (MN_DICTIONARIES_START + 99) + +// id range for suggestions from spell and grammar checker +#define MN_SUGGESTION_START 500 +#define MN_SUGGESTION_END (MN_SUGGESTION_START + MN_MAX_NUM_LANG) + +// id range for auto correction sub menu entries +#define MN_AUTOCORR_START 700 +#define MN_AUTOCORR_END (MN_AUTOCORR_START + MN_MAX_NUM_LANG) + +// max number of language entries sub menus +#define MN_MAX_NUM_LANG 99 + +#define MN_NONE_OFFSET (MN_MAX_NUM_LANG + 1) +#define MN_RESET_OFFSET (MN_MAX_NUM_LANG + 2) +#define MN_MORE_OFFSET (MN_MAX_NUM_LANG + 3) + +// id range for 'set language for selection' sub menu entries +#define MN_SET_LANGUAGE_SELECTION_START 900 +#define MN_SET_LANGUAGE_SELECTION_END (MN_SET_LANGUAGE_SELECTION_START + MN_MAX_NUM_LANG) +#define MN_SET_SELECTION_NONE (MN_SET_LANGUAGE_SELECTION_START + MN_NONE_OFFSET) +#define MN_SET_SELECTION_RESET (MN_SET_LANGUAGE_SELECTION_START + MN_RESET_OFFSET) +#define MN_SET_SELECTION_MORE (MN_SET_LANGUAGE_SELECTION_START + MN_MORE_OFFSET) + +// id range for 'set language for paragraph' sub menu entries +#define MN_SET_LANGUAGE_PARAGRAPH_START 1100 +#define MN_SET_LANGUAGE_PARAGRAPH_END (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MAX_NUM_LANG) +#define MN_SET_PARA_NONE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_NONE_OFFSET) +#define MN_SET_PARA_RESET (MN_SET_LANGUAGE_PARAGRAPH_START + MN_RESET_OFFSET) +#define MN_SET_PARA_MORE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MORE_OFFSET) + +// id range for 'set language for all text' sub menu entries +#define MN_SET_LANGUAGE_ALL_TEXT_START 1300 +#define MN_SET_LANGUAGE_ALL_TEXT_END (MN_SET_LANGUAGE_ALL_TEXT_START + MN_MAX_NUM_LANG) #endif diff --git a/sw/source/ui/lingu/olmenu.src b/sw/source/ui/lingu/olmenu.src index 487215c2bff6..b8d9124d2e52 100644 --- a/sw/source/ui/lingu/olmenu.src +++ b/sw/source/ui/lingu/olmenu.src @@ -38,13 +38,13 @@ Menu MN_SPELL_POPUP { MenuItem { - Identifier = MN_IGNORE ; + Identifier = MN_IGNORE_WORD ; HelpID = HID_LINGU_IGNORE_WORD ; Text [ en-US ] = "Ignore All" ; }; MenuItem { - Identifier = MN_INSERT ; + Identifier = MN_ADD_TO_DIC ; HelpID = HID_LINGU_ADD_WORD ; SubMenu = Menu { @@ -62,14 +62,14 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_SPELLING ; + Identifier = MN_SPELLING_DLG ; HelpID = HID_LINGU_SPELLING_DLG ; Text [ en-US ] = "~Spellcheck..." ; }; SEPARATOR MenuItem { - Identifier = MN_LANGUAGE_SELECTION ; + Identifier = MN_SET_LANGUAGE_SELECTION ; SubMenu = Menu { }; @@ -77,7 +77,7 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_LANGUAGE_PARAGRAPH ; + Identifier = MN_SET_LANGUAGE_PARAGRAPH ; SubMenu = Menu { }; @@ -86,7 +86,7 @@ Menu MN_SPELL_POPUP /* MenuItem { - Identifier = MN_LANGUAGE_ALL_TEXT ; + Identifier = MN_SET_LANGUAGE_ALL_TEXT ; SubMenu = Menu { }; @@ -115,6 +115,11 @@ String STR_LANGSTATUS_NONE { Text [ en-US ] = "None (Do not check spelling)" ; }; +String STR_RESET_TO_DEFAULT_LANGUAGE +{ + Text [ en-US ] = "Reset to Default Language" ; + Text [ x-comment ] = " "; +}; String STR_LANGSTATUS_MORE { Text [ en-US ] = "More..." ; diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 52c4d10c3f02..e795c123d3a2 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -27,13 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> -#include <tools/shl.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> + +#include <tools/shl.hxx> +#include <i18npool/mslangid.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> @@ -117,8 +121,8 @@ #include <docsh.hxx> #include <svl/undo.hxx> -#include "swabstdlg.hxx" //CHINA001 -#include "chrdlg.hrc" //CHINA001 +#include "swabstdlg.hxx" +#include "chrdlg.hrc" #include "misc.hrc" #include <app.hrc> @@ -1138,7 +1142,17 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq) bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh); break; } - case FN_THESAURUS_DLG: + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + break; + } + case SID_THESAURUS: { pOLV->StartThesaurus(); break; @@ -1246,8 +1260,25 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) SwLangHelper::GetLanguageStatus(pOLV,rSet); break; } + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + break; + } + // disable "Thesaurus" if the language is not supported - case FN_THESAURUS_DLG: + case SID_THESAURUS: { const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, @@ -1257,7 +1288,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) - rSet.DisableItem( FN_THESAURUS_DLG ); + rSet.DisableItem( SID_THESAURUS ); } break; case SID_HANGUL_HANJA_CONVERSION: @@ -1295,6 +1326,15 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 94d49720a50c..c95ad7e64c1c 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -27,8 +27,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> + +#include <comphelper/processfactory.hxx> +#include <i18npool/mslangid.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/request.hxx> #include <tools/shl.hxx> #include <svx/svdview.hxx> #include <editeng/spltitem.hxx> @@ -37,9 +43,7 @@ #include <editeng/widwitem.hxx> #include <editeng/kernitem.hxx> #include <editeng/escpitem.hxx> -#ifndef _SVX_PARAITEM_HXX //autogen #include <editeng/lspcitem.hxx> -#endif #include <editeng/adjitem.hxx> #include <editeng/crsditem.hxx> #include <editeng/shdditem.hxx> @@ -49,9 +53,7 @@ #include <editeng/fhgtitem.hxx> #include <editeng/colritem.hxx> #include <editeng/wghtitem.hxx> -#ifndef _SVX_CNTRITEM_HXX //autogen #include <editeng/cntritem.hxx> -#endif #include <editeng/postitem.hxx> #include <editeng/frmdiritem.hxx> #include <svx/svdoutl.hxx> @@ -59,6 +61,8 @@ #include <svl/whiter.hxx> #include <svl/cjkoptions.hxx> #include <svl/ctloptions.hxx> +#include <svtools/langtab.hxx> +#include <svl/languageoptions.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> @@ -67,48 +71,66 @@ #include <editeng/editstat.hxx> #include <svx/hlnkitem.hxx> #include <svx/htmlmode.hxx> +#include <svl/languageoptions.hxx> +#include <svl/slstitm.hxx> #include <editeng/langitem.hxx> +#include <svtools/langtab.hxx> #include <editeng/unolingu.hxx> #include <editeng/scripttypeitem.hxx> #include <editeng/writingmodeitem.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/editeng.hxx> +#include <editeng/editdata.hxx> +#include <editeng/outliner.hxx> +#include <vcl/window.hxx> +#include <editeng/editview.hxx> +#include <vcl/outdev.hxx> +#include <editeng/hyznitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/orphitem.hxx> +#include <editeng/outliner.hxx> +#include <editeng/postitem.hxx> +#include <editeng/scripttypeitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/spltitem.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdview.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/unolingu.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/widwitem.hxx> +#include <editeng/writingmodeitem.hxx> +#include <tools/shl.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/outdev.hxx> +#include <vcl/window.hxx> + +#include <cmdid.h> #include <doc.hxx> -#include <wview.hxx> -#include <viewopt.hxx> -#include <wrtsh.hxx> -#include <uitool.hxx> +#include <docstat.hxx> +#include <drwtxtsh.hxx> +#include <edtwin.hxx> +#include <globals.hrc> +#include <hintids.hxx> +#include <initui.hxx> // fuer SpellPointer +#include <langhelper.hxx> #include <pardlg.hxx> +#include <shells.hrc> +#include <string.h> #include <swdtflvr.hxx> -#include <drwtxtsh.hxx> #include <swmodule.hxx> -#include <initui.hxx> // fuer SpellPointer -#include <edtwin.hxx> #include <swwait.hxx> -#include <docstat.hxx> - -#include <comphelper/processfactory.hxx> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <uitool.hxx> +#include <viewopt.hxx> +#include <wrtsh.hxx> +#include <wview.hxx> -#include <cmdid.h> -#include <globals.hrc> -#include <shells.hrc> #include "swabstdlg.hxx" #include "chrdlg.hrc" #include "misc.hrc" -//modified on Jul. 30th -#include <svl/languageoptions.hxx> -#include <editeng/langitem.hxx> -#include <svtools/langtab.hxx> -#include <svl/slstitm.hxx> -#include <string.h> - -#include <editeng/eeitem.hxx> -#include <editeng/editeng.hxx> -#include <editeng/editdata.hxx> -#include <editeng/outliner.hxx> -#include <vcl/window.hxx> -#include <editeng/editview.hxx> -#include <vcl/outdev.hxx> #include <langhelper.hxx> @@ -148,6 +170,18 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh); break; } + + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + break; + } + case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -569,7 +603,27 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);; break; } - case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST; + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + + //! avoid puting the same item as SfxBoolItem at the end of this function + nSlotId = 0; + break; + } + + case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST; @@ -620,19 +674,17 @@ ASK_ESCAPE: } break; - case FN_THESAURUS_DLG: + case SID_THESAURUS: { // disable "Thesaurus" if the language is not supported const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) ); - LanguageType nLang = ((const SvxLanguageItem &) - rItem).GetLanguage(); - // + LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - if (!xThes.is() || nLang == LANGUAGE_NONE || - !xThes->hasLocale( SvxCreateLocale( nLang ) )) - rSet.DisableItem( FN_THESAURUS_DLG ); + if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) + rSet.DisableItem( SID_THESAURUS ); nSlotId = 0; } break; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 4b8e2c65c5fc..78a9b05ce70b 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -52,6 +52,7 @@ #include <editeng/editstat.hxx> #include <svx/svdoutl.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -392,7 +393,7 @@ void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq) { switch(rReq.GetSlot()) { - case FN_THESAURUS_DLG: + case SID_THESAURUS: pOLV->StartThesaurus(); break; @@ -717,6 +718,15 @@ void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq ) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx index 3a0fe1421a0c..37d5e1ed5d69 100755..100644 --- a/sw/source/ui/shells/langhelper.cxx +++ b/sw/source/ui/shells/langhelper.cxx @@ -66,7 +66,8 @@ using namespace ::com::sun::star; namespace SwLangHelper { - USHORT GetLanguageStatus(OutlinerView* pOLV,SfxItemSet& rSet) + + USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ) { ESelection aSelection = pOLV->GetSelection(); EditView& rEditView=pOLV->GetEditView(); @@ -110,7 +111,7 @@ namespace SwLangHelper return 0; } - bool SetLanguageStatus(OutlinerView* pOLV,SfxRequest &rReq,SwView &rView,SwWrtShell &rSh) + bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh ) { bool bRestoreSelection = false; SfxItemSet aEditAttr(pOLV->GetAttribs()); @@ -130,126 +131,132 @@ namespace SwLangHelper //!! SwTextShell got destroyed meanwhile.) SfxViewFrame *pViewFrame = rView.GetViewFrame(); - if (aNewLangTxt.EqualsAscii( "*" )) + if (aNewLangTxt.EqualsAscii( "*" )) + { + // open the dialog "Tools/Options/Language Settings - Language" + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if (pFact) { - // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS ); - pDlg->Execute(); - delete pDlg; - } + VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS ); + pDlg->Execute(); + delete pDlg; } - else + } + else + { + // setting the new language... + if (aNewLangTxt.Len() > 0) { - // setting the new language... - if (aNewLangTxt.Len() > 0) + const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); + const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); + const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); + const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); + const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); + + xub_StrLen nPos = 0; + bool bForSelection = true; + bool bForParagraph = false; + if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) { - const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); - const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); - const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); - const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); - - xub_StrLen nPos = 0; - bool bForSelection = true; - bool bForParagraph = false; - if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) - { - // ... for the current selection - aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); - bForSelection = true; - } - else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) - { - // ... for the current paragraph language - aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); - bForSelection = true; - bForParagraph = true; - } - else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) - { - // ... as default document language - aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); - bForSelection = false; - } + // ... for the current selection + aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); + bForSelection = true; + } + else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) + { + // ... for the current paragraph language + aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); + bForSelection = true; + bForParagraph = true; + } + else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) + { + // ... as default document language + aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); + bForSelection = false; + } - if (bForParagraph) - { - bRestoreSelection = true; - SwLangHelper::SelectPara( rEditView, aSelection ); - aSelection = pOLV->GetSelection(); - } - if (!bForSelection) // document language to be changed... - { - rSh.StartAction(); - rSh.LockView( TRUE ); - rSh.Push(); + if (bForParagraph) + { + bRestoreSelection = true; + SwLangHelper::SelectPara( rEditView, aSelection ); + aSelection = pOLV->GetSelection(); + } + if (!bForSelection) // document language to be changed... + { + rSh.StartAction(); + rSh.LockView( TRUE ); + rSh.Push(); - // prepare to apply new language to all text in document - rSh.SelAll(); - rSh.ExtendedSelectAll(); - } + // prepare to apply new language to all text in document + rSh.SelAll(); + rSh.ExtendedSelectAll(); + } + + if (aNewLangTxt == aStrNone) + SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr ); + else if (aNewLangTxt == aStrResetLangs) + SwLangHelper::ResetLanguages( rSh, pOLV, aSelection, bForSelection ); + else + SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangTxt, bForSelection, aEditAttr ); - if (aNewLangTxt != aStrNone) - SwLangHelper::SetLanguage( rSh, pEditEngine, aSelection, aNewLangTxt, bForSelection, aEditAttr ); + // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks + // when setting a new language attribute + if (bForSelection) + { + const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); + ULONG nCntrl = pEditEngine->GetControlWord(); + // turn off + if (!pVOpt->IsOnlineSpell()) + nCntrl &= ~EE_CNTRL_ONLINESPELLING; else - SwLangHelper::SetLanguage_None( rSh, pEditEngine, aSelection, bForSelection, aEditAttr ); + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); - // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks - // when setting a new language attribute - if (bForSelection) - { - const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); - ULONG nCntrl = pEditEngine->GetControlWord(); - // turn off - if (!pVOpt->IsOnlineSpell()) - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - else - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - //turn back on - if (pVOpt->IsOnlineSpell()) - nCntrl |= EE_CNTRL_ONLINESPELLING; - else - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - pEditEngine->CompleteOnlineSpelling(); - rEditView.Invalidate(); - } + //turn back on + if (pVOpt->IsOnlineSpell()) + nCntrl |= EE_CNTRL_ONLINESPELLING; + else + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); - if (!bForSelection) - { - // need to release view and restore selection... - rSh.Pop( FALSE ); - rSh.LockView( FALSE ); - rSh.EndAction(); - } + pEditEngine->CompleteOnlineSpelling(); + rEditView.Invalidate(); + } + + if (!bForSelection) + { + // need to release view and restore selection... + rSh.Pop( FALSE ); + rSh.LockView( FALSE ); + rSh.EndAction(); } } + } - // invalidate slot to get the new language displayed - pViewFrame->GetBindings().Invalidate( rReq.GetSlot() ); + // invalidate slot to get the new language displayed + pViewFrame->GetBindings().Invalidate( rReq.GetSlot() ); - rReq.Done(); - return bRestoreSelection; + rReq.Done(); + return bRestoreSelection; } - void SetLanguage(SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet) + void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ) { - SetLanguage(rWrtSh,0,ESelection(),rLangText,bIsForSelection,rCoreSet); + SetLanguage( rWrtSh, 0 , ESelection(), rLangText, bIsForSelection, rCoreSet ); } - void SetLanguage(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet) + void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ) { const LanguageType nLang = SvtLanguageTable().GetType( rLangText ); if (nLang != LANGUAGE_DONTKNOW) { USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ); + EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL; + DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" ); + //get ScriptType USHORT nLangWhichId = 0; bool bIsSingleScriptType = true; @@ -264,6 +271,9 @@ namespace SwLangHelper } if (bIsSingleScriptType) { + // change language for selection or paragraph + // (for paragraph is handled by previosuly having set the selection to the + // whole paragraph) if (bIsForSelection) { // apply language to current selection @@ -279,7 +289,7 @@ namespace SwLangHelper rWrtSh.SetAttr( rCoreSet ); } } - else // change document language + else // change language for all text { // set document default language switch (nLangWhichId) @@ -300,12 +310,12 @@ namespace SwLangHelper } } - void SetLanguage_None(SwWrtShell &rWrtSh,bool bIsForSelection, SfxItemSet &rCoreSet ) + void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ) { - SetLanguage_None(rWrtSh,0,ESelection(),bIsForSelection,rCoreSet); + SetLanguage_None( rWrtSh,0,ESelection(),bIsForSelection,rCoreSet ); } - void SetLanguage_None(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ) + void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ) { // EditEngine IDs const USHORT aLangWhichId_EE[3] = @@ -325,7 +335,12 @@ namespace SwLangHelper if (bIsForSelection) { - // apply language to current selection + // change language for selection or paragraph + // (for paragraph is handled by previosuly having set the selection to the + // whole paragraph) + + EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL; + DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" ); if (pEditEngine) { for (sal_uInt16 i = 0; i < 3; ++i) @@ -340,7 +355,7 @@ namespace SwLangHelper rWrtSh.SetAttr( rCoreSet ); } } - else // change document language + else // change language for all text { SvUShortsSort aAttribs; for (sal_uInt16 i = 0; i < 3; ++i) @@ -355,6 +370,39 @@ namespace SwLangHelper } } + void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection ) + { + ResetLanguages( rWrtSh, 0 , ESelection(), bIsForSelection ); + } + + void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection ) + { + (void) bIsForSelection; + (void) aSelection; + + // reset language for current selection. + // The selection should already have been expanded to the whole paragraph or + // to all text in the document if those are the ranges where to reset + // the language attributes + + if (pOLV) + { + EditView &rEditView = pOLV->GetEditView(); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE ); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK ); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL ); + } + else + { + SvUShortsSort aAttribs; + aAttribs.Insert( RES_CHRATR_LANGUAGE ); + aAttribs.Insert( RES_CHRATR_CJK_LANGUAGE ); + aAttribs.Insert( RES_CHRATR_CTL_LANGUAGE ); + rWrtSh.ResetAttr( &aAttribs ); + } + } + + /// @returns : the language for the selected text that is set for the /// specified attribute (script type). /// If there are more than one languages used LANGUAGE_DONTKNOW will be returned. @@ -450,7 +498,7 @@ namespace SwLangHelper /// 'In use' means the language(s) matching the script type(s) of the /// selected text. Or in other words, the language a spell checker would use. /// If there is more than one language LANGUAGE_DONTKNOW will be returned. - LanguageType GetCurrentLanguage(SfxItemSet aSet,USHORT nScriptType ) + LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType ) { //set language attribute to use according to the script type USHORT nLangWhichId = 0; @@ -517,7 +565,7 @@ namespace SwLangHelper return aText; } - String GetTextForLanguageGuessing(EditEngine* rEditEngine, ESelection aDocSelection ) + String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection ) { // string for guessing language String aText; diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index c2308b9def0a..0de14dc3dacb 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -62,7 +62,8 @@ #include <svx/htmlmode.hxx> #include <svx/pfiledlg.hxx> #include <svtools/htmlcfg.hxx> -#include <com/sun/star/i18n/TransliterationModules.hdl> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <sot/clsids.hxx> #include <editeng/acorrcfg.hxx> @@ -1027,6 +1028,15 @@ void SwTextShell::ExecTransliteration( SfxRequest & rReq ) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index b7aa72acfb2c..e7d7ef613f2b 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -27,7 +27,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + +#include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> + #include <comphelper/processfactory.hxx> #include <svx/dialogs.hrc> #include <hintids.hxx> @@ -338,6 +341,7 @@ void SwTextShell::Execute(SfxRequest &rReq) const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); + const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); SfxItemSet aCoreSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, @@ -376,10 +380,12 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.SelAll(); rWrtSh.ExtendedSelectAll(); } - if (aNewLangTxt != aStrNone) - SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); - else + if (aNewLangTxt == aStrNone) SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet ); + else if (aNewLangTxt == aStrResetLangs) + SwLangHelper::ResetLanguages( rWrtSh, bForSelection ); + else + SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); } // restore selection... @@ -396,6 +402,23 @@ void SwTextShell::Execute(SfxRequest &rReq) break; } + case SID_THES: + { + // replace word/selection with text from selected sub menu entry + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + { + SwView &rView2 = rWrtSh.GetView(); + const bool bSelection = rWrtSh.HasSelection(); + const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection ); + rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); + } + } + break; + case SID_CHARMAP: { InsertSymbol( rReq ); @@ -1375,6 +1398,38 @@ void SwTextShell::GetState( SfxItemSet &rSet ) } break; + case SID_THES: + { + // is there a valid selection to get text from? + String aText; + sal_Bool bValid = !rSh.HasSelection() || + (rSh.IsSelOnePara() && !rSh.IsMultiSelection()); + // prevent context menu from showing when cursor is not in or at the end of a word + // (GetCurWord will return the next word if there is none at the current position...) + const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD; + bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType ); + if (bValid && bWord) + aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord(); + + LanguageType nLang = rSh.GetCurLang(); + lang::Locale aLocale = SvxCreateLocale( nLang ); + String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); + + // set word and locale to look up as status value + String aStatusVal( aText ); + aStatusVal.AppendAscii( "#" ); + aStatusVal += aLangText; + + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + if (aText.Len() == 0 || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + } + break; + case FN_NUMBER_NEWSTART : if(!rSh.GetCurNumRule()) rSet.DisableItem(nWhich); diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src index 7c47fe6ef208..9cf4f910f183 100644 --- a/sw/source/ui/uiview/view.src +++ b/sw/source/ui/uiview/view.src @@ -299,8 +299,8 @@ ToolBox RID_TOOLS_TOOLBOX }; ToolBoxItem { - Identifier = FN_THESAURUS_DLG; - HelpID = FN_THESAURUS_DLG; + Identifier = SID_THESAURUS; + HelpID = SID_THESAURUS; Hide = TRUE; }; ToolBoxItem diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 04414b5d83db..b3f73f7c38e4 100644..100755 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -120,7 +120,7 @@ void SwView::ExecLingu(SfxRequest &rReq) { switch(rReq.GetSlot()) { - case FN_THESAURUS_DLG: + case SID_THESAURUS: StartThesaurus(); rReq.Ignore(); break; @@ -252,64 +252,31 @@ void SwView::StartTextConversion( // do not do text conversion if it is active elsewhere if (GetWrtShell().HasConvIter()) { -// MessBox( 0, WB_OK, String( SW_RES( STR_SPELL_TITLE ) ), -// String( SW_RES( STR_MULT_INTERACT_SPELL_WARN ) ) ).Execute(); return; } -/* - SfxErrorContext aContext( ERRCTX_SVX_LINGU_SPELLING, aEmptyStr, pEditWin, - RID_SVXERRCTX, DIALOG_MGR() ); - Reference< XSpellChecker1 > xSpell = ::GetSpellChecker(); - if(!xSpell.is()) - { // keine Arme keine Kekse - ErrorHandler::HandleError( ERRCODE_SVX_LINGU_LINGUNOTEXISTS ); - return; - } -*/ SpellKontext(sal_True); - SwViewOption* pVOpt = (SwViewOption*)pWrtShell->GetViewOptions(); - sal_Bool bOldIdle = pVOpt->IsIdle(); + const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); + const sal_Bool bOldIdle = pVOpt->IsIdle(); pVOpt->SetIdle( sal_False ); sal_Bool bOldIns = pWrtShell->IsInsMode(); pWrtShell->SetInsMode( sal_True ); + sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() || + pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); - { - sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() || - pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); - -// sal_Bool bIsSpellSpecial = sal_True; - - sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc(); - sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); + sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc(); + sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); -/* - if( bOther && !bIsSpellSpecial ) - // kein Sonderbereich eingeschaltet - { - // Ich will auch in Sonderbereichen trennen - QueryBox aBox( &GetEditWin(), SW_RES( DLG_SPECIAL_FORCED ) ); - if( aBox.Execute() == RET_YES && xProp.is()) - { - sal_Bool bTrue = sal_True; - Any aTmp(&bTrue, ::getBooleanCppuType()); - xProp->setPropertyValue( C2U(UPN_IS_SPELL_SPECIAL), aTmp ); - } - else - return; // Nein Es wird nicht gespellt - } -*/ - { - const uno::Reference< lang::XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, - nOptions, bIsInteractive, - bStart, bOther, bSelection ); - aWrap.Convert(); - } + { + const uno::Reference< lang::XMultiServiceFactory > xMgr( + comphelper::getProcessServiceFactory() ); + SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, + nOptions, bIsInteractive, + bStart, bOther, bSelection ); + aWrap.Convert(); } pWrtShell->SetInsMode( bOldIns ); @@ -557,16 +524,77 @@ void SwView::HyphenateDocument() } /*-------------------------------------------------------------------- + --------------------------------------------------------------------*/ + +bool SwView::IsValidSelectionForThesaurus() const +{ + // must not be a multi-selection, and if it is a selection it needs + // to be within a single paragraph + + const bool bMultiSel = pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); + const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); + return !bMultiSel && (!bSelection || pWrtShell->IsSelOnePara() ); +} + + +String SwView::GetThesaurusLookUpText( bool bSelection ) const +{ + return bSelection ? pWrtShell->GetSelTxt() : pWrtShell->GetCurWord(); +} + + +void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bSelection ) +{ + sal_Bool bOldIns = pWrtShell->IsInsMode(); + pWrtShell->SetInsMode( sal_True ); + + pWrtShell->StartAllAction(); + pWrtShell->StartUndo(UNDO_DELETE); + + if( !bSelection ) + { + if(pWrtShell->IsEndWrd()) + pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE ); + + pWrtShell->SelWrd(); + + // make sure the selection build later from the + // data below does not include footnotes and other + // "in word" character to the left and right in order + // to preserve those. Therefore count those "in words" + // in order to modify the selection accordingly. + const sal_Unicode* pChar = rLookUpText.GetBuffer(); + xub_StrLen nLeft = 0; + while (pChar && *pChar++ == CH_TXTATR_INWORD) + ++nLeft; + pChar = rLookUpText.Len() ? rLookUpText.GetBuffer() + rLookUpText.Len() - 1 : 0; + xub_StrLen nRight = 0; + while (pChar && *pChar-- == CH_TXTATR_INWORD) + ++nRight; + + // adjust existing selection + SwPaM *pCrsr = pWrtShell->GetCrsr(); + pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight; + pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft; + } + + pWrtShell->Insert( rSynonmText ); + + pWrtShell->EndUndo(UNDO_DELETE); + pWrtShell->EndAllAction(); + + pWrtShell->SetInsMode( bOldIns ); +} + + +/*-------------------------------------------------------------------- Beschreibung: Thesaurus starten --------------------------------------------------------------------*/ void SwView::StartThesaurus() { - if( pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext() ) - return; - sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); - if( bSelection && !pWrtShell->IsSelOnePara() ) + if (!IsValidSelectionForThesaurus()) return; SfxErrorContext aContext( ERRCTX_SVX_LINGU_THESAURUS, aEmptyStr, pEditWin, @@ -589,114 +617,32 @@ void SwView::StartThesaurus() sal_Bool bOldIdle = pVOpt->IsIdle(); pVOpt->SetIdle( sal_False ); -#ifdef TL_NEVER -//!!! hier mu� noch was getan werden... (Umsetzung der Funktionalitaet) - // ErrorLink setzen, alten merken - Link aOldLnk = pSpell->ChgErrorLink(LINK(this, SwView, SpellError)); -#endif - - // get initial LookUp text - String aTmp = bSelection ? - pWrtShell->GetSelTxt() : pWrtShell->GetCurWord(); + const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); + String aTmp = GetThesaurusLookUpText( bSelection ); Reference< XThesaurus > xThes( ::GetThesaurus() ); AbstractThesaurusDialog *pDlg = NULL; if ( !xThes.is() || !xThes->hasLocale( SvxCreateLocale( eLang ) ) ) - { SpellError( &eLang ); - } else { // create dialog { //Scope for SwWait-Object SwWait aWait( *GetDocShell(), sal_True ); + // load library with dialog only on demand ... SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - pDlg = pFact->CreateThesaurusDialog( &GetEditWin(), - xThes, aTmp, eLang ); - } - - { - // Hier wird der Thesaurus-Dialog im Applikationsfenster zentriert, - // und zwar oberhalb oder unterhalb der Cursorposition, je nachdem, - // wo mehr Platz ist. - - // Current Word: - SwRect aRect( pWrtShell->GetCharRect() ); - Point aTopPos = aRect.Pos(); - Point aBtmPos( aTopPos.X(), aRect.Bottom() ); - aTopPos = GetEditWin().LogicToPixel( aTopPos ); - aTopPos = GetEditWin().OutputToScreenPixel( aTopPos ); - aBtmPos = GetEditWin().LogicToPixel( aBtmPos ); - aBtmPos = GetEditWin().OutputToScreenPixel( aBtmPos ); - // ::frame::Desktop: - Rectangle aRct = GetEditWin().GetDesktopRectPixel(); - Point aWinTop( aRct.TopLeft() ); - Point aWinBtm( aRct.BottomRight() ); - if ( aTopPos.Y() - aWinTop.Y() > aWinBtm.Y() - aBtmPos.Y() ) - aWinBtm.Y() = aTopPos.Y(); - else - aWinTop.Y() = aBtmPos.Y(); - - Size aSz = pDlg->GetWindow()->GetSizePixel(); - if ( aWinBtm.Y() - aWinTop.Y() > aSz.Height() ) - { - aWinTop.X() = ( aWinTop.X() + aWinBtm.X() - aSz.Width() ) / 2; - aWinTop.Y() = ( aWinTop.Y() + aWinBtm.Y() - aSz.Height() ) / 2; - pDlg->GetWindow()->SetPosPixel( aWinTop ); - } + pDlg = pFact->CreateThesaurusDialog( &GetEditWin(), xThes, aTmp, eLang ); } if ( pDlg->Execute()== RET_OK ) - { - sal_Bool bOldIns = pWrtShell->IsInsMode(); - pWrtShell->SetInsMode( sal_True ); - - pWrtShell->StartAllAction(); - pWrtShell->StartUndo(UNDO_DELETE); - - if( !bSelection ) - { - if(pWrtShell->IsEndWrd()) - pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE ); - - pWrtShell->SelWrd(); - - // make sure the selection build later from the - // data below does not include footnotes and other - // "in word" character to the left and right in order - // to preserve those. Therefore count those "in words" - // in order to modify the selection accordingly. - const sal_Unicode* pChar = aTmp.GetBuffer(); - xub_StrLen nLeft = 0; - while (pChar && *pChar++ == CH_TXTATR_INWORD) - ++nLeft; - pChar = aTmp.Len() ? aTmp.GetBuffer() + aTmp.Len() - 1 : 0; - xub_StrLen nRight = 0; - while (pChar && *pChar-- == CH_TXTATR_INWORD) - ++nRight; - - // adjust existing selection - SwPaM *pCrsr = pWrtShell->GetCrsr(); - pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight; - pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft; - } - - pWrtShell->Insert( pDlg->GetWord() ); - - pWrtShell->EndUndo(UNDO_DELETE); - pWrtShell->EndAllAction(); - - pWrtShell->SetInsMode( bOldIns ); - - } + InsertThesaurusSynonym( pDlg->GetWord(), aTmp, bSelection ); } delete pDlg; pVOpt->SetIdle( bOldIdle ); - } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 23415b630252..f23b73f5dfad 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -303,7 +303,7 @@ void SwView::GetState(SfxItemSet &rSet) rSet.DisableItem( nWhich ); } break; - case FN_THESAURUS_DLG: + case SID_THESAURUS: { SwWrtShell &rSh = GetWrtShell(); if (2 <= rSh.GetCrsrCnt()) // multi selection? diff --git a/sw/source/ui/web/web.src b/sw/source/ui/web/web.src index 1aa7fc03b4c6..3d24d885dfa8 100644 --- a/sw/source/ui/web/web.src +++ b/sw/source/ui/web/web.src @@ -138,8 +138,8 @@ ToolBox RID_WEBTOOLS_TOOLBOX }; ToolBoxItem { - Identifier = FN_THESAURUS_DLG; - HelpID = FN_THESAURUS_DLG; + Identifier = SID_THESAURUS; + HelpID = SID_THESAURUS; Hide = TRUE; }; ToolBoxItem diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index 7fb8db664b59..c3bef67c8c12 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -217,12 +217,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml index 308406bfdffa..4b482e373d3f 100644 --- a/sw/uiconfig/sweb/menubar/menubar.xml +++ b/sw/uiconfig/sweb/menubar/menubar.xml @@ -165,12 +165,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:FormatColumns"/> diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml index 726b8905eadb..69b65cfd3e59 100644 --- a/sw/uiconfig/swform/menubar/menubar.xml +++ b/sw/uiconfig/swform/menubar/menubar.xml @@ -217,12 +217,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml index 726b8905eadb..69b65cfd3e59 100644 --- a/sw/uiconfig/swreport/menubar/menubar.xml +++ b/sw/uiconfig/swreport/menubar/menubar.xml @@ -217,12 +217,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 9634079ddeb2..fb10ca615b50 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -220,12 +220,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml index 89ab81e790cf..ae0df22748fe 100644 --- a/sw/uiconfig/swxform/menubar/menubar.xml +++ b/sw/uiconfig/swxform/menubar/menubar.xml @@ -218,12 +218,15 @@ <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> - <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> - <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> - <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> - <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> + <menu:menuitem menu:id=".uno:ChangeCaseToTitleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToToggleCase"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> + <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> + <menu:menuitem menu:id=".uno:ChangeCaseToKatakana"/> </menu:menupopup> </menu:menu> <menu:menuitem menu:id=".uno:RubyDialog"/> |